diff --git a/ts/export/packer/express.ts b/ts/export/packer/express.ts index 20a25cd843..bee0d53462 100644 --- a/ts/export/packer/express.ts +++ b/ts/export/packer/express.ts @@ -1,12 +1,13 @@ import {Packer} from "./packer"; import * as fs from "fs"; import * as express from "express"; +import {Document} from "../../docx/document"; export class ExpressPacker extends Packer { private res: express.Response; - constructor(res: express.Response) { - super(); + constructor(document: Document, res: express.Response) { + super(document); this.res = res; this.res.on('close', () => { diff --git a/ts/export/packer/local.ts b/ts/export/packer/local.ts index af9b0775e6..a7d66c966f 100644 --- a/ts/export/packer/local.ts +++ b/ts/export/packer/local.ts @@ -1,11 +1,12 @@ import {Packer} from "./packer"; import * as fs from 'fs'; +import {Document} from "../../docx/document"; export class LocalPacker extends Packer { private stream: fs.WriteStream - constructor(path: string) { - super(); + constructor(document: Document, path: string) { + super(document); this.stream = fs.createWriteStream(path); } diff --git a/ts/export/packer/packer.ts b/ts/export/packer/packer.ts index d3bf55211f..0421d2e6d3 100644 --- a/ts/export/packer/packer.ts +++ b/ts/export/packer/packer.ts @@ -1,13 +1,16 @@ import * as archiver from "archiver"; import * as fs from "fs"; import {Formatter} from "../formatter"; +import {Document} from "../../docx"; export abstract class Packer { protected archive: any; private formatter: Formatter; + protected document: Document; - constructor() { + constructor(document: Document) { this.formatter = new Formatter(); + this.document = document; this.archive = archiver.create("zip", {}); this.archive.on('error', (err) => { diff --git a/ts/tests/bodyTest.ts b/ts/tests/bodyTest.ts index 1b89b7080f..7475a4d7fa 100644 --- a/ts/tests/bodyTest.ts +++ b/ts/tests/bodyTest.ts @@ -8,7 +8,7 @@ function jsonify(obj: Object) { return JSON.parse(stringifiedJson); } -describe('Body', () => { +describe.only('Body', () => { var body: Body; beforeEach(() => { @@ -16,6 +16,9 @@ describe('Body', () => { }); describe('#constructor()', () => { - + + it("should create the correct xml components", () => { + console.log(body); + }); }); }); \ No newline at end of file diff --git a/ts/tests/localPackerTest.ts b/ts/tests/localPackerTest.ts index 6de495b08b..7959c4dc4d 100644 --- a/ts/tests/localPackerTest.ts +++ b/ts/tests/localPackerTest.ts @@ -4,12 +4,14 @@ import {LocalPacker} from "../export/packer/local"; import {assert} from "chai"; +import {Document} from "../docx/document" -describe.only('Packer', () => { +describe('Packer', () => { var packer: LocalPacker; beforeEach(() => { - packer = new LocalPacker("test.zip"); + var document = new Document(); + packer = new LocalPacker(document, "build/tests/test.zip"); }); describe('#pack()', () => {