fix linter warnings in runTest.ts

This commit is contained in:
felipe
2017-03-08 20:28:59 +01:00
parent 237be76d33
commit 81e0d56918

View File

@ -1,10 +1,10 @@
import { assert } from "chai";
import { Run } from "../../../docx/run"; import { Run } from "../../../docx/run";
import { TextRun } from "../../../docx/run/text-run"; import { TextRun } from "../../../docx/run/text-run";
import { assert } from "chai"; import { Formatter } from "../../../export/formatter";
function jsonify(obj: Object) { function jsonify(obj: object) {
let stringifiedJson = JSON.stringify(obj); return JSON.parse(JSON.stringify(obj));
return JSON.parse(stringifiedJson);
} }
describe("Run", () => { describe("Run", () => {
@ -17,7 +17,7 @@ describe("Run", () => {
describe("#bold()", () => { describe("#bold()", () => {
it("it should add bold to the properties", () => { it("it should add bold to the properties", () => {
run.bold(); run.bold();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:b"); assert.equal(newJson.root[0].root[0].rootKey, "w:b");
}); });
}); });
@ -25,7 +25,7 @@ describe("Run", () => {
describe("#italic()", () => { describe("#italic()", () => {
it("it should add italics to the properties", () => { it("it should add italics to the properties", () => {
run.italic(); run.italic();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:i"); assert.equal(newJson.root[0].root[0].rootKey, "w:i");
}); });
}); });
@ -33,7 +33,7 @@ describe("Run", () => {
describe("#underline()", () => { describe("#underline()", () => {
it("it should add underline to the properties", () => { it("it should add underline to the properties", () => {
run.underline(); run.underline();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:u"); assert.equal(newJson.root[0].root[0].rootKey, "w:u");
}); });
}); });
@ -41,7 +41,7 @@ describe("Run", () => {
describe("#smallCaps()", () => { describe("#smallCaps()", () => {
it("it should add smallCaps to the properties", () => { it("it should add smallCaps to the properties", () => {
run.smallCaps(); run.smallCaps();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:smallCaps"); assert.equal(newJson.root[0].root[0].rootKey, "w:smallCaps");
}); });
}); });
@ -49,7 +49,7 @@ describe("Run", () => {
describe("#caps()", () => { describe("#caps()", () => {
it("it should add caps to the properties", () => { it("it should add caps to the properties", () => {
run.allCaps(); run.allCaps();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:caps"); assert.equal(newJson.root[0].root[0].rootKey, "w:caps");
}); });
}); });
@ -57,7 +57,7 @@ describe("Run", () => {
describe("#strike()", () => { describe("#strike()", () => {
it("it should add strike to the properties", () => { it("it should add strike to the properties", () => {
run.strike(); run.strike();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:strike"); assert.equal(newJson.root[0].root[0].rootKey, "w:strike");
}); });
}); });
@ -65,26 +65,24 @@ describe("Run", () => {
describe("#doubleStrike()", () => { describe("#doubleStrike()", () => {
it("it should add caps to the properties", () => { it("it should add caps to the properties", () => {
run.doubleStrike(); run.doubleStrike();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:dstrike"); assert.equal(newJson.root[0].root[0].rootKey, "w:dstrike");
}); });
}); });
describe("#break()", () => { describe("#break()", () => {
it("it should add break to the run", () => { it("it should add break to the run", () => {
let run = new Run();
run.break(); run.break();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[1].rootKey, "w:br"); assert.equal(newJson.root[1].rootKey, "w:br");
}); });
}); });
describe("#tab()", () => { describe("#tab()", () => {
it("it should add break to the run", () => { it("it should add break to the run", () => {
let run = new Run();
run.tab(); run.tab();
let newJson = jsonify(run); const newJson = jsonify(run);
assert.equal(newJson.root[1].rootKey, "w:tab"); assert.equal(newJson.root[1].rootKey, "w:tab");
}); });
}); });
}); });