From 106ea9f6749c10fe32ee934b7680f13b119d6937 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 4 Dec 2018 21:51:15 +0000 Subject: Fix eslint errors in tests --- package.json | 2 +- test/document-to-html.tests.js | 8 ++++---- test/docx/body-reader.tests.js | 9 +-------- test/docx/comments-reader.tests.js | 2 -- test/docx/docx-reader.tests.js | 11 +++++------ test/docx/office-xml-reader.tests.js | 30 +++++++++++++++--------------- test/docx/relationships-reader.tests.js | 4 ++-- test/docx/uris.tests.js | 4 ++-- test/transforms.tests.js | 2 +- 9 files changed, 31 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 00ed74f..23c2782 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "mammoth": "bin/mammoth" }, "scripts": { - "pretest": "eslint lib tests", + "pretest": "eslint lib test", "test": "mocha 'test/**/*.tests.js'", "prepublish": "make mammoth.browser.min.js" }, diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index 8e6546b..8a42ae3 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -756,11 +756,11 @@ function runOfText(text, properties) { } test('when initials are not blank then comment author label is initials', function() { - assert.equal(commentAuthorLabel({authorInitials: "TP"}), "TP") + assert.equal(commentAuthorLabel({authorInitials: "TP"}), "TP"); }); test('when initials are blank then comment author label is blank', function() { - assert.equal(commentAuthorLabel({authorInitials: ""}), "") - assert.equal(commentAuthorLabel({authorInitials: undefined}), "") - assert.equal(commentAuthorLabel({authorInitials: null}), "") + assert.equal(commentAuthorLabel({authorInitials: ""}), ""); + assert.equal(commentAuthorLabel({authorInitials: undefined}), ""); + assert.equal(commentAuthorLabel({authorInitials: null}), ""); }); diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index a458834..bcedcee 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -503,7 +503,7 @@ var booleanRunProperties = [ {name: "isUnderline", tagName: "w:u"}, {name: "isItalic", tagName: "w:i"}, {name: "isStrikethrough", tagName: "w:strike"}, - {name: "isSmallCaps", tagName: "w:smallCaps"}, + {name: "isSmallCaps", tagName: "w:smallCaps"} ]; booleanRunProperties.forEach(function(runProperty) { @@ -1250,13 +1250,6 @@ function runOfText(text) { return new XmlElement("w:r", {}, [textXml]); } -function assertImageBuffer(element, expectedImageBuffer) { - return element.read() - .then(function(readValue) { - assert.equal(readValue, expectedImageBuffer); - }); -} - function hyperlinkRelationship(relationshipId, target) { return { relationshipId: relationshipId, diff --git a/test/docx/comments-reader.tests.js b/test/docx/comments-reader.tests.js index 0b3c0ce..668ee19 100644 --- a/test/docx/comments-reader.tests.js +++ b/test/docx/comments-reader.tests.js @@ -26,7 +26,6 @@ test('ID and body of comment are read', function() { test('when optional attributes of comment are missing then they are read as null', function() { - var body = [xml.element("w:p")]; var comment = readComment(xml.element("w:comments", {}, [ xml.element("w:comment", {"w:id": "1"}) ])); @@ -36,7 +35,6 @@ test('when optional attributes of comment are missing then they are read as null test('when optional attributes of comment are blank then they are read as null', function() { - var body = [xml.element("w:p")]; var comment = readComment(xml.element("w:comments", {}, [ xml.element("w:comment", {"w:id": "1", "w:author": " ", "w:initials": " "}) ])); diff --git a/test/docx/docx-reader.tests.js b/test/docx/docx-reader.tests.js index de36216..db9faff 100644 --- a/test/docx/docx-reader.tests.js +++ b/test/docx/docx-reader.tests.js @@ -88,7 +88,6 @@ test("error is thrown when main document part does not exist", function() { }); - test("part paths", { "main document part is found using package relationships": function() { var relationships = xml.element("r:Relationships", {}, [ @@ -120,23 +119,23 @@ test("part paths", { [ { name: "comments", - type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", + type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" }, { name: "endnotes", - type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", + type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" }, { name: "footnotes", - type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", + type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" }, { name: "numbering", - type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", + type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" }, { name: "styles", - type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", + type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" } ].forEach(function(options) { test(options.name + " part is found using main document relationships", function() { diff --git a/test/docx/office-xml-reader.tests.js b/test/docx/office-xml-reader.tests.js index 6cd9d7d..9a053bc 100644 --- a/test/docx/office-xml-reader.tests.js +++ b/test/docx/office-xml-reader.tests.js @@ -6,19 +6,19 @@ var test = require("../test")(module); test("mc:AlternateContent is replaced by contents of mc:Fallback", function() { - var xmlString = - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; - return officeXmlReader.read(xmlString).then(function(element) { - assert.deepEqual(element.children, [xml.element("fallback")]); - }); + var xmlString = + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; + return officeXmlReader.read(xmlString).then(function(element) { + assert.deepEqual(element.children, [xml.element("fallback")]); + }); }); diff --git a/test/docx/relationships-reader.tests.js b/test/docx/relationships-reader.tests.js index 60db3b4..1427b1c 100644 --- a/test/docx/relationships-reader.tests.js +++ b/test/docx/relationships-reader.tests.js @@ -57,9 +57,9 @@ test("when there are no relationships of requested type then empty array is retu function relationshipsElement(children) { - return xml.element("{http://schemas.openxmlformats.org/package/2006/relationships}Relationships", {}, children) + return xml.element("{http://schemas.openxmlformats.org/package/2006/relationships}Relationships", {}, children); } function relationshipElement(attributes) { - return xml.element("{http://schemas.openxmlformats.org/package/2006/relationships}Relationship", attributes, []) + return xml.element("{http://schemas.openxmlformats.org/package/2006/relationships}Relationship", attributes, []); } diff --git a/test/docx/uris.tests.js b/test/docx/uris.tests.js index 5b2afab..2c7476c 100644 --- a/test/docx/uris.tests.js +++ b/test/docx/uris.tests.js @@ -9,14 +9,14 @@ test("uriToZipEntryName", { assert.equal( zipfile.uriToZipEntryName("one/two", "three/four"), "one/two/three/four" - ) + ); }, "when path has leading slash then base is ignored": function() { assert.equal( zipfile.uriToZipEntryName("one/two", "/three/four"), "three/four" - ) + ); } }); diff --git a/test/transforms.tests.js b/test/transforms.tests.js index d9112b2..ab185f5 100644 --- a/test/transforms.tests.js +++ b/test/transforms.tests.js @@ -91,7 +91,7 @@ test("getDescendants()", { "includes children": function() { var element = { children: [{name: "child 1"}, {name: "child 2"}] - } + }; assert.deepEqual( transforms.getDescendants(element), [{name: "child 1"}, {name: "child 2"}] -- cgit v1.2.3