Add more tests
This commit is contained in:
8
.nycrc
8
.nycrc
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"check-coverage": true,
|
"check-coverage": true,
|
||||||
"lines": 98.47,
|
"lines": 98.53,
|
||||||
"functions": 96.44,
|
"functions": 96.59,
|
||||||
"branches": 95.39,
|
"branches": 95.51,
|
||||||
"statements": 98.45,
|
"statements": 98.51,
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.ts"
|
||||||
],
|
],
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "file/xml-components";
|
||||||
|
|
||||||
export interface ICustomPropertiesAttributes {
|
export class CustomPropertiesAttributes extends XmlAttributeComponent<{
|
||||||
readonly xmlns: string;
|
readonly xmlns: string;
|
||||||
readonly vt: string;
|
readonly vt: string;
|
||||||
}
|
}> {
|
||||||
|
|
||||||
export class CustomPropertiesAttributes extends XmlAttributeComponent<ICustomPropertiesAttributes> {
|
|
||||||
protected readonly xmlKeys = {
|
protected readonly xmlKeys = {
|
||||||
xmlns: "xmlns",
|
xmlns: "xmlns",
|
||||||
vt: "xmlns:vt",
|
vt: "xmlns:vt",
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "file/xml-components";
|
||||||
|
|
||||||
export interface ICustomPropertyAttributes {
|
export class CustomPropertyAttributes extends XmlAttributeComponent<{
|
||||||
readonly fmtid: string;
|
readonly fmtid: string;
|
||||||
readonly pid: string;
|
readonly pid: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
}
|
}> {
|
||||||
|
|
||||||
export class CustomPropertyAttributes extends XmlAttributeComponent<ICustomPropertyAttributes> {
|
|
||||||
protected readonly xmlKeys = {
|
protected readonly xmlKeys = {
|
||||||
fmtid: "fmtid",
|
fmtid: "fmtid",
|
||||||
pid: "pid",
|
pid: "pid",
|
||||||
|
@ -77,19 +77,23 @@ describe("Media", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return UInt8Array if atob is present", () => {
|
it("should return UInt8Array if atob is present", () => {
|
||||||
// tslint:disable-next-line
|
global.atob = () => "atob result";
|
||||||
((process as any).atob as any) = () => "atob result";
|
|
||||||
|
|
||||||
const image = new Media().addMedia("");
|
const image = new Media().addMedia("");
|
||||||
expect(image.stream).to.be.an.instanceof(Uint8Array);
|
expect(image.stream).to.be.an.instanceof(Uint8Array);
|
||||||
|
|
||||||
|
// tslint:disable-next-line: no-any
|
||||||
|
(global as any).atob = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use data as is if its not a string", () => {
|
it("should use data as is if its not a string", () => {
|
||||||
// tslint:disable-next-line
|
global.atob = () => "atob result";
|
||||||
((process as any).atob as any) = () => "atob result";
|
|
||||||
|
|
||||||
const image = new Media().addMedia(new Buffer(""));
|
const image = new Media().addMedia(Buffer.from(""));
|
||||||
expect(image.stream).to.be.an.instanceof(Uint8Array);
|
expect(image.stream).to.be.an.instanceof(Uint8Array);
|
||||||
|
|
||||||
|
// tslint:disable-next-line: no-any
|
||||||
|
(global as any).atob = undefined;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user