Add tests

This commit is contained in:
Dolan
2020-11-04 01:28:46 +00:00
parent 34b2029efe
commit c7ea26e422

View File

@ -5,7 +5,7 @@ import { Formatter } from "export/formatter";
import { File } from "./file"; import { File } from "./file";
import { Footer, Header } from "./header"; import { Footer, Header } from "./header";
import { HyperlinkRef, Paragraph } from "./paragraph"; import { HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph";
import { Table, TableCell, TableRow } from "./table"; import { Table, TableCell, TableRow } from "./table";
import { TableOfContents } from "./table-of-contents"; import { TableOfContents } from "./table-of-contents";
@ -243,12 +243,40 @@ describe("File", () => {
}); });
}); });
describe("#addTrackRevisionsFeature", () => {
it("should call the underlying document's add", () => {
const file = new File({
features: {
trackRevisions: true,
},
});
// tslint:disable-next-line: no-unused-expression no-string-literal
expect(file.Settings["trackRevisions"]).to.exist;
});
});
describe("#HyperlinkCache", () => { describe("#HyperlinkCache", () => {
it("should initially have empty hyperlink cache", () => { it("should initially have empty hyperlink cache", () => {
const file = new File(); const file = new File();
expect(file.HyperlinkCache).to.deep.equal({}); expect(file.HyperlinkCache).to.deep.equal({});
}); });
it("should have hyperlink cache when option is added", () => {
const file = new File({
hyperlinks: {
myCoolLink: {
link: "http://www.example.com",
text: "Hyperlink",
type: HyperlinkType.EXTERNAL,
},
},
});
// tslint:disable-next-line: no-unused-expression no-string-literal
expect(file.HyperlinkCache["myCoolLink"]).to.exist;
});
}); });
describe("#createFootnote", () => { describe("#createFootnote", () => {