aboutsummaryrefslogtreecommitdiff
path: root/tests/mammoth.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-08-15 10:00:12 +0100
committerMichael Williamson <mike@zwobble.org>2015-08-15 10:00:12 +0100
commit57299a40f7517ac4934ac391b44656500bac024d (patch)
treee7028502e2e2f5450266ca90fc0942898417000a /tests/mammoth.tests.js
parent1507381c0afbd2c2aaefe4fba8970c4a875886e9 (diff)
Generate warnings for not-understood style mappings and continue
Diffstat (limited to 'tests/mammoth.tests.js')
-rw-r--r--tests/mammoth.tests.js14
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")