diff options
Diffstat (limited to 'tests/mammoth.tests.js')
| -rw-r--r-- | tests/mammoth.tests.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 6fdd60f..64439f1 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -4,6 +4,7 @@ var fs = require("fs"); var mammoth = require("../"); var promises = require("../lib/promises"); +var results = require("../lib/results"); var testing = require("./testing"); var test = testing.test; @@ -95,6 +96,19 @@ describe('mammoth', function() { }); }); + test('warning if style mapping is not understood', function() { + var docxPath = path.join(__dirname, "test-data/single-paragraph.docx"); + var options = { + styleMap: "!!!!\np => h1" + }; + return mammoth.convertToHtml({path: docxPath}, options).then(function(result) { + assert.equal("<h1>Walking on imported air</h1>", result.value); + var warning = "Did not understand this style mapping, so ignored it: !!!!\n" + + 'Error was at character number 1: Expected element type but got unrecognisedCharacter "!"'; + assert.deepEqual(result.messages, [results.warning(warning)]); + }); + }); + test('options are passed to document converter when calling mammoth.convertToHtml', function() { var docxFile = createFakeDocxFile({ "word/document.xml": testData("simple/word/document.xml") |
