Files
docx-js/ts/tests/localPackerTest.ts

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-03-31 18:03:16 +01:00
/// <reference path="../typings/mocha/mocha.d.ts" />
/// <reference path="../typings/chai/chai.d.ts" />
2016-03-31 18:07:22 +01:00
/// <reference path="../typings/archiver/archiver.d.ts" />
2016-04-05 01:49:12 +01:00
/// <reference path="../typings/xml/xml.d.ts" />
2016-03-31 18:07:22 +01:00
2016-03-31 18:03:16 +01:00
import {LocalPacker} from "../export/packer/local";
import {assert} from "chai";
import {Document} from "../docx/document"
2016-04-05 01:49:12 +01:00
import {Properties} from "../properties"
2016-04-09 04:27:49 +01:00
import {DefaultStyle} from "../styles/sample"
2016-04-05 22:11:21 +01:00
import {Paragraph} from "../docx/paragraph"
2016-03-31 18:03:16 +01:00
2016-04-09 04:27:49 +01:00
describe("Packer", () => {
2016-03-31 18:03:16 +01:00
var packer: LocalPacker;
beforeEach(() => {
var document = new Document();
2016-04-05 22:11:21 +01:00
var paragraph = new Paragraph("test text");
document.addParagraph(paragraph);
2016-04-05 01:49:12 +01:00
var properties = new Properties({
2016-04-08 23:01:50 +01:00
creator: "Shan Fu",
revision: "1",
lastModifiedBy: "Shan Fu"
2016-04-05 01:49:12 +01:00
});
2016-04-08 23:01:50 +01:00
packer = new LocalPacker(document, DefaultStyle(), properties, "build/tests/test.docx");
2016-03-31 18:03:16 +01:00
});
2016-05-02 22:39:03 +01:00
describe('#pack()', () => {
2016-03-31 18:03:16 +01:00
2016-04-05 22:11:21 +01:00
it("should create a standard docx file", (done) => {
2016-03-31 18:03:16 +01:00
packer.pack();
2016-04-09 04:53:42 +01:00
setTimeout(done, 1900);
2016-03-31 18:03:16 +01:00
});
});
});