Files
docx-js/src/export/packer/local.spec.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-12-05 00:16:21 +00:00
/* tslint:disable:typedef space-before-function-paren */
import * as fs from "fs";
2017-03-09 22:56:08 +00:00
import { LocalPacker } from "../../export/packer/local";
import { File, Paragraph } from "../../file";
2016-03-31 18:03:16 +01:00
2017-12-19 23:13:11 +00:00
describe("LocalPacker", () => {
2016-05-26 15:08:34 +01:00
let packer: LocalPacker;
2016-03-31 18:03:16 +01:00
beforeEach(() => {
2017-12-15 02:15:44 +00:00
const file = new File({
2016-07-19 18:45:07 +01:00
creator: "Dolan Miu",
2016-04-08 23:01:50 +01:00
revision: "1",
2017-03-09 22:56:08 +00:00
lastModifiedBy: "Dolan Miu",
2016-04-05 01:49:12 +01:00
});
2017-12-15 02:15:44 +00:00
const paragraph = new Paragraph("test text");
const heading = new Paragraph("Hello world").heading1();
file.addParagraph(new Paragraph("title").title());
file.addParagraph(heading);
file.addParagraph(new Paragraph("heading 2").heading2());
file.addParagraph(paragraph);
packer = new LocalPacker(file);
2016-03-31 18:03:16 +01:00
});
2016-05-26 15:08:34 +01:00
describe("#pack()", () => {
2017-12-06 01:32:57 +00:00
it("should create a standard docx file", async function () {
2016-07-01 22:09:55 +01:00
this.timeout(99999999);
2017-12-06 01:32:57 +00:00
await packer.pack("build-tests/tests/test");
fs.statSync("build-tests/tests/test.docx");
2016-03-31 18:03:16 +01:00
});
2017-12-06 01:03:14 +00:00
});
2017-12-05 00:16:21 +00:00
2017-12-06 01:03:14 +00:00
describe("#packPdf", () => {
2017-12-05 00:16:21 +00:00
it("should create a standard PDF file", async function () {
this.timeout(99999999);
await packer.packPdf("build-tests/tests/pdf-test");
fs.statSync("build-tests/tests/pdf-test.pdf");
});
2016-03-31 18:03:16 +01:00
});
2017-03-09 22:56:08 +00:00
});