diff --git a/package.json b/package.json index 02a873d048..28af81dcfd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "build/index.js", "scripts": { "pretest": "tsc -p ts/tests", - "test": "./node_modules/.bin/mocha ./build/tests/**/*Test.js", + "test": "mocha ./build/tests/**/*.*", "prepublish": "tsc -p ts" }, "repository": { diff --git a/ts/tests/_testTemplate.ts b/ts/tests/_testTemplate.ts new file mode 100644 index 0000000000..44081f71a4 --- /dev/null +++ b/ts/tests/_testTemplate.ts @@ -0,0 +1,22 @@ +/// +/// + +import {assert} from "chai"; + +function jsonify(obj: Object) { + let stringifiedJson = JSON.stringify(obj); + return JSON.parse(stringifiedJson); +} + +describe("", () => { + + beforeEach(() => { + + }); + + describe("#methodName()", () => { + it("should ", () => { + + }); + }); +}); \ No newline at end of file diff --git a/ts/tests/bodyTest.ts b/ts/tests/docx/document/bodyTest.ts similarity index 72% rename from ts/tests/bodyTest.ts rename to ts/tests/docx/document/bodyTest.ts index a3112dfbd6..22bcfce941 100644 --- a/ts/tests/bodyTest.ts +++ b/ts/tests/docx/document/bodyTest.ts @@ -1,12 +1,12 @@ -/// -/// -import {Body} from "../docx/document/body"; +/// +/// +import {Body} from "../../../docx/document/body"; import {assert} from "chai"; -import {SectionProperties} from "../docx/document/body/section-properties"; -import {PageSize} from "../docx/document/body/page-size"; -import {PageMargin} from "../docx/document/body/page-margin"; -import {Columns} from "../docx/document/body/columns"; -import {DocumentGrid} from "../docx/document/body/doc-grid"; +import {SectionProperties} from "../../../docx/document/body/section-properties"; +import {PageSize} from "../../../docx/document/body/page-size"; +import {PageMargin} from "../../../docx/document/body/page-margin"; +import {Columns} from "../../../docx/document/body/columns"; +import {DocumentGrid} from "../../../docx/document/body/doc-grid"; function jsonify(obj: Object) { let stringifiedJson = JSON.stringify(obj); diff --git a/ts/tests/documentTest.ts b/ts/tests/docx/document/documentTest.ts similarity index 77% rename from ts/tests/documentTest.ts rename to ts/tests/docx/document/documentTest.ts index b5045033c3..11e2828510 100644 --- a/ts/tests/documentTest.ts +++ b/ts/tests/docx/document/documentTest.ts @@ -1,6 +1,7 @@ -/// -/// -import * as docx from "../docx"; +/// +/// + +import * as docx from "../../../docx"; import {assert} from "chai"; describe("Document", () => { diff --git a/ts/tests/attributeTest.ts b/ts/tests/docx/document/xml-components/attributeTest.ts similarity index 86% rename from ts/tests/attributeTest.ts rename to ts/tests/docx/document/xml-components/attributeTest.ts index f384e73d4b..e9d23a9286 100644 --- a/ts/tests/attributeTest.ts +++ b/ts/tests/docx/document/xml-components/attributeTest.ts @@ -1,6 +1,7 @@ -/// -/// -import {Attributes} from "../docx/xml-components"; +/// +/// + +import {Attributes} from "../../../../docx/xml-components"; import {assert} from "chai"; describe("Attribute", () => { diff --git a/ts/tests/borderTest.ts b/ts/tests/docx/paragraph/borderTest.ts similarity index 81% rename from ts/tests/borderTest.ts rename to ts/tests/docx/paragraph/borderTest.ts index 27b1dfdd15..c2fff70f69 100644 --- a/ts/tests/borderTest.ts +++ b/ts/tests/docx/paragraph/borderTest.ts @@ -1,6 +1,7 @@ -/// -/// -import {ThematicBreak} from "../docx/paragraph/border"; +/// +/// + +import {ThematicBreak} from "../../../docx/paragraph/border"; import {assert} from "chai"; function jsonify(obj: Object) { diff --git a/ts/tests/paragraphStyleTest.ts b/ts/tests/docx/paragraph/paragraphStyleTest.ts similarity index 80% rename from ts/tests/paragraphStyleTest.ts rename to ts/tests/docx/paragraph/paragraphStyleTest.ts index 46e5b71d54..a9543d39f6 100644 --- a/ts/tests/paragraphStyleTest.ts +++ b/ts/tests/docx/paragraph/paragraphStyleTest.ts @@ -1,6 +1,7 @@ -/// -/// -import {Style} from "../docx/paragraph/style"; +/// +/// + +import {Style} from "../../../docx/paragraph/style"; import {assert} from "chai"; function jsonify(obj: Object) { diff --git a/ts/tests/paragraphTest.ts b/ts/tests/docx/paragraph/paragraphTest.ts similarity index 95% rename from ts/tests/paragraphTest.ts rename to ts/tests/docx/paragraph/paragraphTest.ts index fa31a16179..0a2c0f69a7 100644 --- a/ts/tests/paragraphTest.ts +++ b/ts/tests/docx/paragraph/paragraphTest.ts @@ -1,6 +1,7 @@ -/// -/// -import * as docx from "../docx"; +/// +/// + +import * as docx from "../../../docx"; import {assert} from "chai"; function jsonify(obj: Object) { diff --git a/ts/tests/runTest.ts b/ts/tests/docx/run/runTest.ts similarity index 86% rename from ts/tests/runTest.ts rename to ts/tests/docx/run/runTest.ts index 7b59035538..8077d50c51 100644 --- a/ts/tests/runTest.ts +++ b/ts/tests/docx/run/runTest.ts @@ -1,7 +1,8 @@ -/// -/// -import {Run} from "../docx/run"; -import {TextRun} from "../docx//run/text-run"; +/// +/// + +import {Run} from "../../../docx/run"; +import {TextRun} from "../../../docx/run/text-run"; import {assert} from "chai"; function jsonify(obj: Object) { diff --git a/ts/tests/formatterTest.ts b/ts/tests/export/formatterTest.ts similarity index 87% rename from ts/tests/formatterTest.ts rename to ts/tests/export/formatterTest.ts index a5969b732a..243a483e41 100644 --- a/ts/tests/formatterTest.ts +++ b/ts/tests/export/formatterTest.ts @@ -1,12 +1,11 @@ -/// -/// -/// - -import {Formatter} from "../export/Formatter"; -import * as docx from "../docx"; -import {Attributes} from "../docx/xml-components"; -import {Properties} from "../properties"; +/// +/// +/// +import {Formatter} from "../../export/Formatter"; +import * as docx from "../../docx"; +import {Attributes} from "../../docx/xml-components"; +import {Properties} from "../../properties"; import {assert} from "chai"; function jsonify(obj: Object) { diff --git a/ts/tests/localPackerTest.ts b/ts/tests/export/localPackerTest.ts similarity index 61% rename from ts/tests/localPackerTest.ts rename to ts/tests/export/localPackerTest.ts index 2d4509f2d9..b68410242c 100644 --- a/ts/tests/localPackerTest.ts +++ b/ts/tests/export/localPackerTest.ts @@ -1,17 +1,17 @@ -/// -/// -/// -/// +/// +/// +/// +/// -import {LocalPacker} from "../export/packer/local"; +import {LocalPacker} from "../../export/packer/local"; import {assert} from "chai"; -import {Document} from "../docx/document"; -import {Properties} from "../properties"; -import {DefaultStyle} from "../styles/sample"; -import {Paragraph} from "../docx/paragraph"; -import {DefaultStylesFactory} from "../styles/factory"; +import {Document} from "../../docx/document"; +import {Properties} from "../../properties"; +import {DefaultStyle} from "../../styles/sample"; +import {Paragraph} from "../../docx/paragraph"; +import {DefaultStylesFactory} from "../../styles/factory"; -describe.only("Packer", () => { +describe("Packer", () => { let packer: LocalPacker; let stylesFactory: DefaultStylesFactory; @@ -34,8 +34,8 @@ describe.only("Packer", () => { }); describe("#pack()", () => { - - it("should create a standard docx file", (done) => { + it("should create a standard docx file", function (done) { + this.timeout(99999999); packer.pack(); setTimeout(done, 1900); }); diff --git a/ts/tests/numberingTest.ts b/ts/tests/numberingTest.ts new file mode 100644 index 0000000000..4587ad233b --- /dev/null +++ b/ts/tests/numberingTest.ts @@ -0,0 +1,24 @@ +/// +/// + +import {assert} from "chai"; +import {Numbering} from "../numbering"; + +function jsonify(obj: Object) { + let stringifiedJson = JSON.stringify(obj); + return JSON.parse(stringifiedJson); +} + +describe("", () => { + + let numbering = new Numbering; + beforeEach(() => { + numbering = new Numbering(); + }); + + describe("#methodName()", () => { + it("should ", () => { + + }); + }); +}); \ No newline at end of file diff --git a/ts/tests/stylesTest.ts b/ts/tests/stylesTest.ts index f38999c468..72ecd15d04 100644 --- a/ts/tests/stylesTest.ts +++ b/ts/tests/stylesTest.ts @@ -1,5 +1,6 @@ /// /// + import {Styles} from "../styles"; import {assert} from "chai";