Fix tests

This commit is contained in:
Dolan
2018-01-28 20:23:30 +00:00
parent ba39d806b7
commit 635c58c131
2 changed files with 10 additions and 10 deletions

View File

@ -22,7 +22,7 @@ describe("SectionProperties", () => {
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"]).to.be.an.instanceof(Array);
expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906 } }] }); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906, "w:orient": "portrait" } }] });
expect(tree["w:sectPr"][1]).to.deep.equal({ expect(tree["w:sectPr"][1]).to.deep.equal({
"w:pgMar": [ "w:pgMar": [
{ {
@ -45,7 +45,7 @@ describe("SectionProperties", () => {
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"]).to.be.an.instanceof(Array);
expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906 } }] }); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906, "w:orient": "portrait" } }] });
expect(tree["w:sectPr"][1]).to.deep.equal({ expect(tree["w:sectPr"][1]).to.deep.equal({
"w:pgMar": [ "w:pgMar": [
{ {
@ -70,7 +70,7 @@ describe("SectionProperties", () => {
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"]).to.be.an.instanceof(Array);
expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906 } }] }); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906, "w:orient": "portrait" } }] });
expect(tree["w:sectPr"][1]).to.deep.equal({ expect(tree["w:sectPr"][1]).to.deep.equal({
"w:pgMar": [ "w:pgMar": [
{ {
@ -95,7 +95,7 @@ describe("SectionProperties", () => {
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"]).to.be.an.instanceof(Array);
expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906 } }] }); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906, "w:orient": "portrait" } }] });
expect(tree["w:sectPr"][1]).to.deep.equal({ expect(tree["w:sectPr"][1]).to.deep.equal({
"w:pgMar": [ "w:pgMar": [
{ {
@ -121,7 +121,7 @@ describe("SectionProperties", () => {
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"]).to.be.an.instanceof(Array);
expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 0, "w:w": 0 } }] }); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 0, "w:w": 0, "w:orient": "portrait" } }] });
expect(tree["w:sectPr"][1]).to.deep.equal({ expect(tree["w:sectPr"][1]).to.deep.equal({
"w:pgMar": [ "w:pgMar": [
{ {

View File

@ -32,7 +32,7 @@ describe("Document", () => {
expect(body) expect(body)
.to.be.an("array") .to.be.an("array")
.which.has.length.at.least(1); .which.has.length.at.least(1);
expect(body[0]).to.have.property("w:p"); expect(body[1]).to.have.property("w:p");
}); });
it("should use the text given to create a run in the paragraph", () => { it("should use the text given to create a run in the paragraph", () => {
@ -42,7 +42,7 @@ describe("Document", () => {
expect(body) expect(body)
.to.be.an("array") .to.be.an("array")
.which.has.length.at.least(1); .which.has.length.at.least(1);
expect(body[0]) expect(body[1])
.to.have.property("w:p") .to.have.property("w:p")
.which.includes({ .which.includes({
"w:r": [{ "w:rPr": [] }, { "w:t": [{ _attr: { "xml:space": "preserve" } }, "sample paragraph text"] }], "w:r": [{ "w:rPr": [] }, { "w:t": [{ _attr: { "xml:space": "preserve" } }, "sample paragraph text"] }],
@ -58,7 +58,7 @@ describe("Document", () => {
expect(body) expect(body)
.to.be.an("array") .to.be.an("array")
.which.has.length.at.least(1); .which.has.length.at.least(1);
expect(body[0]).to.have.property("w:tbl"); expect(body[1]).to.have.property("w:tbl");
}); });
it("should create a table with the correct dimensions", () => { it("should create a table with the correct dimensions", () => {
@ -67,7 +67,7 @@ describe("Document", () => {
expect(body) expect(body)
.to.be.an("array") .to.be.an("array")
.which.has.length.at.least(1); .which.has.length.at.least(1);
expect(body[0]) expect(body[1])
.to.have.property("w:tbl") .to.have.property("w:tbl")
.which.includes({ .which.includes({
"w:tblGrid": [ "w:tblGrid": [
@ -76,7 +76,7 @@ describe("Document", () => {
{ "w:gridCol": [{ _attr: { "w:w": 1 } }] }, { "w:gridCol": [{ _attr: { "w:w": 1 } }] },
], ],
}); });
expect(body[0]["w:tbl"].filter((x) => x["w:tr"])).to.have.length(2); expect(body[1]["w:tbl"].filter((x) => x["w:tr"])).to.have.length(2);
}); });
}); });
}); });