Make compiler take in a file

This commit is contained in:
Dolan
2017-12-15 02:15:44 +00:00
parent d19ff1e300
commit 742e2b5089
6 changed files with 76 additions and 68 deletions

View File

@ -1,31 +1,27 @@
/* tslint:disable:typedef space-before-function-paren */
import * as fs from "fs";
import { Document } from "../../docx/document";
import { File } from "../../docx";
import { Paragraph } from "../../docx/paragraph";
import { LocalPacker } from "../../export/packer/local";
import { Properties } from "../../properties";
import { DefaultStylesFactory } from "../../styles/factory";
describe("LocalPacker", () => {
describe.only("LocalPacker", () => {
let packer: LocalPacker;
let stylesFactory: DefaultStylesFactory;
beforeEach(() => {
const document = new Document();
const paragraph = new Paragraph("test text");
const heading = new Paragraph("Hello world").heading1();
document.addParagraph(new Paragraph("title").title());
document.addParagraph(heading);
document.addParagraph(new Paragraph("heading 2").heading2());
document.addParagraph(paragraph);
const properties = new Properties({
const file = new File({
creator: "Dolan Miu",
revision: "1",
lastModifiedBy: "Dolan Miu",
});
stylesFactory = new DefaultStylesFactory();
packer = new LocalPacker(document, stylesFactory.newInstance(), properties);
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);
});
describe("#pack()", () => {