fixed tests
This commit is contained in:
@ -16,7 +16,7 @@ describe("Attribute", () => {
|
||||
var newAttrs = new Attributes();
|
||||
var stringifiedJson = JSON.stringify(newAttrs);
|
||||
var newJson = JSON.parse(stringifiedJson);
|
||||
assert.isUndefined(newJson._attr.val);
|
||||
assert.isUndefined(newJson.root.val);
|
||||
});
|
||||
|
||||
it("should have val as defined with populated constructor", () => {
|
||||
@ -25,7 +25,7 @@ describe("Attribute", () => {
|
||||
});
|
||||
var stringifiedJson = JSON.stringify(newAttrs);
|
||||
var newJson = JSON.parse(stringifiedJson);
|
||||
assert(newJson._attr.val === "test");
|
||||
assert.equal(newJson.root.val, "test");
|
||||
});
|
||||
|
||||
it("should have space value as defined with populated constructor", () => {
|
||||
@ -34,7 +34,7 @@ describe("Attribute", () => {
|
||||
});
|
||||
var stringifiedJson = JSON.stringify(newAttrs);
|
||||
var newJson = JSON.parse(stringifiedJson);
|
||||
assert(newJson._attr.space === "spaceTest");
|
||||
assert.equal(newJson.root.space, "spaceTest");
|
||||
});
|
||||
});
|
||||
});
|
@ -29,28 +29,27 @@ describe("Body", () => {
|
||||
|
||||
it("should create the Section Properties", () => {
|
||||
var newJson = jsonify(body);
|
||||
console.log(newJson);
|
||||
assert.isDefined(newJson.body[0].sectPr);
|
||||
assert.equal(newJson.root[0].rootKey, "w:sectPr");
|
||||
});
|
||||
|
||||
it("should create the Page Size", () => {
|
||||
var newJson = jsonify(body);
|
||||
assert.isDefined(newJson.body[1].pgSz);
|
||||
assert.equal(newJson.root[1].rootKey, "w:pgSz");
|
||||
});
|
||||
|
||||
it("should create the Page Margin", () => {
|
||||
var newJson = jsonify(body);
|
||||
assert.isDefined(newJson.body[2].pgMar);
|
||||
assert.equal(newJson.root[2].rootKey, "w:pgMar");
|
||||
});
|
||||
|
||||
it("should create the Columns", () => {
|
||||
var newJson = jsonify(body);
|
||||
assert.isDefined(newJson.body[3].cols);
|
||||
assert.equal(newJson.root[3].rootKey, "w:cols");
|
||||
});
|
||||
|
||||
it("should create the Document Grid", () => {
|
||||
var newJson = jsonify(body);
|
||||
assert.isDefined(newJson.body[4].docGrid);
|
||||
assert.equal(newJson.root[4].rootKey, "w:docGrid");
|
||||
});
|
||||
});
|
||||
});
|
@ -28,8 +28,7 @@ describe("ThematicBreak", () => {
|
||||
val: "single",
|
||||
sz: "6"
|
||||
};
|
||||
delete newJson.pBdr[0].bottom[0]._attr.xmlKeys;
|
||||
assert(JSON.stringify(newJson.pBdr[0].bottom[0]._attr) === JSON.stringify(attributes));
|
||||
assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes));
|
||||
});
|
||||
})
|
||||
});
|
@ -25,7 +25,7 @@ describe("Packer", () => {
|
||||
packer = new LocalPacker(document, DefaultStyle(), properties, "build/tests/test.docx");
|
||||
});
|
||||
|
||||
describe.only('#pack()', () => {
|
||||
describe('#pack()', () => {
|
||||
|
||||
it("should create a standard docx file", (done) => {
|
||||
packer.pack();
|
||||
|
@ -21,8 +21,7 @@ describe("Properties", () => {
|
||||
title: "test document"
|
||||
});
|
||||
var newJson = jsonify(properties);
|
||||
|
||||
assert(newJson.coreProperties[1].title === "test document");
|
||||
assert(newJson.root[1].root === "test document");
|
||||
});
|
||||
})
|
||||
});
|
@ -20,7 +20,7 @@ describe("Run", () => {
|
||||
it("it should add bold to the properties", () => {
|
||||
run.bold();
|
||||
var newJson = jsonify(run);
|
||||
assert.isDefined(newJson.r[0].rPr[0].b);
|
||||
assert.equal(newJson.root[0].root[0].rootKey, "w:b");
|
||||
});
|
||||
});
|
||||
|
||||
@ -28,7 +28,7 @@ describe("Run", () => {
|
||||
it("it should add italics to the properties", () => {
|
||||
run.italics();
|
||||
var newJson = jsonify(run);
|
||||
assert.isDefined(newJson.r[0].rPr[0].i);
|
||||
assert.equal(newJson.root[0].root[0].rootKey, "w:i");
|
||||
});
|
||||
});
|
||||
|
||||
@ -36,7 +36,7 @@ describe("Run", () => {
|
||||
it("it should add underline to the properties", () => {
|
||||
run.underline();
|
||||
var newJson = jsonify(run);
|
||||
assert.isDefined(newJson.r[0].rPr[0].u);
|
||||
assert.equal(newJson.root[0].root[0].rootKey, "w:u");
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -49,7 +49,8 @@ describe('TextRun', () => {
|
||||
it("should add text into run", () => {
|
||||
run = new TextRun("test");
|
||||
var newJson = jsonify(run);
|
||||
assert(newJson.r[1].t === "test");
|
||||
console.log(newJson.root[1].root)
|
||||
assert.equal(newJson.root[1].root, "test");
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user