Files
docx-js/src/file/document/document.spec.ts

32 lines
808 B
TypeScript
Raw Normal View History

2017-03-10 14:11:28 +01:00
import { assert, expect } from "chai";
2018-10-26 01:04:07 +01:00
import { Formatter } from "export/formatter";
2018-01-31 01:23:13 +00:00
import { Document } from "./document";
2016-03-29 04:10:33 +01:00
2016-04-03 05:24:56 +01:00
describe("Document", () => {
2018-01-31 01:23:13 +00:00
let document: Document;
2016-03-29 04:10:33 +01:00
beforeEach(() => {
2018-01-31 01:23:13 +00:00
document = new Document();
2016-03-29 04:10:33 +01:00
});
2016-05-26 15:08:34 +01:00
describe("#constructor()", () => {
2016-03-29 04:10:33 +01:00
it("should create valid JSON", () => {
2017-03-09 22:31:55 +00:00
const stringifiedJson = JSON.stringify(document);
2016-03-29 04:10:33 +01:00
try {
2018-01-31 23:24:55 +00:00
JSON.parse(stringifiedJson);
2016-03-29 04:10:33 +01:00
} catch (e) {
assert.isTrue(false);
}
assert.isTrue(true);
});
it("should create default section", () => {
const body = new Formatter().format(document)["w:document"][1]["w:body"];
expect(body[0]).to.have.property("w:sectPr");
});
2016-03-29 04:10:33 +01:00
});
2017-03-09 22:31:55 +00:00
});