From f5e1cbb69b1aae679f8629fe13d0c49778b181d0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 18 Apr 2013 20:12:51 +0100 Subject: Emit warnings if paragraph style is not recognised --- tests/document-to-html.tests.js | 10 ++++++++++ tests/mammoth.tests.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index f1e6402..d63813d 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -85,6 +85,16 @@ describe('DocumentConverter', function() { }); }); + test('warning is emitted if style is unrecognised', function() { + var document = new documents.Document([ + paragraphOfText("Hello.", "Heading1"), + ]); + var converter = new DocumentConverter(); + return converter.convertToHtml(document).then(function(result) { + assert.deepEqual(result.messages, [results.warning("Unrecognised paragraph style: Heading1")]); + }); + }); + test('can use stacked styles to generate nested HTML elements', function() { var document = new documents.Document([ paragraphOfText("Hello.", "Heading1") diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 49bc02f..d8235ff 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -18,7 +18,8 @@ describe('mammoth', function() { var docxPath = path.join(__dirname, "test-data/single-paragraph.docx"); var converter = new mammoth.Converter(); return converter.convertToHtml({path: docxPath}).then(function(result) { - assert.equal("

Walking on imported air

", result.value); + assert.equal(result.value, "

Walking on imported air

"); + assert.deepEqual(result.messages, []); }); }); -- cgit v1.2.3