From a080fc59a3fca08bdc6e23a2eeae440f5c7047b3 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 Jul 2016 22:17:34 +0100 Subject: Use exports for all tests --- test/docx/docx-reader.tests.js | 54 ++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'test/docx/docx-reader.tests.js') diff --git a/test/docx/docx-reader.tests.js b/test/docx/docx-reader.tests.js index 69ade7e..283d03a 100644 --- a/test/docx/docx-reader.tests.js +++ b/test/docx/docx-reader.tests.js @@ -4,39 +4,37 @@ var docxReader = require("../../lib/docx/docx-reader"); var documents = require("../../lib/documents"); var testing = require("../testing"); -var test = testing.test; +var test = require("../test")(module); var testData = testing.testData; var createFakeDocxFile = testing.createFakeDocxFile; -describe("docx-reader", function() { - test("can read document with single paragraph with single run of text", function() { - var expectedDocument = documents.Document([ - documents.Paragraph([ - documents.Run([ - documents.Text("Hello.") - ]) +test("can read document with single paragraph with single run of text", function() { + var expectedDocument = documents.Document([ + documents.Paragraph([ + documents.Run([ + documents.Text("Hello.") ]) - ]); - var docxFile = createFakeDocxFile({ - "word/document.xml": testData("simple/word/document.xml") - }); - return docxReader.read(docxFile).then(function(result) { - assert.deepEqual(expectedDocument, result.value); - }); + ]) + ]); + var docxFile = createFakeDocxFile({ + "word/document.xml": testData("simple/word/document.xml") }); - - test("hyperlink hrefs are read from relationships file", function() { - var docxFile = createFakeDocxFile({ - "word/document.xml": testData("hyperlinks/word/document.xml"), - "word/_rels/document.xml.rels": testData("hyperlinks/word/_rels/document.xml.rels") - }); - return docxReader.read(docxFile).then(function(result) { - var paragraph = result.value.children[0]; - assert.equal(1, paragraph.children.length); - var hyperlink = paragraph.children[0]; - assert.equal(hyperlink.href, "http://www.example.com"); - assert.equal(hyperlink.children.length, 1); - }); + return docxReader.read(docxFile).then(function(result) { + assert.deepEqual(expectedDocument, result.value); + }); +}); + +test("hyperlink hrefs are read from relationships file", function() { + var docxFile = createFakeDocxFile({ + "word/document.xml": testData("hyperlinks/word/document.xml"), + "word/_rels/document.xml.rels": testData("hyperlinks/word/_rels/document.xml.rels") + }); + return docxReader.read(docxFile).then(function(result) { + var paragraph = result.value.children[0]; + assert.equal(1, paragraph.children.length); + var hyperlink = paragraph.children[0]; + assert.equal(hyperlink.href, "http://www.example.com"); + assert.equal(hyperlink.children.length, 1); }); }); -- cgit v1.2.3