From 5f5217a4e16f7be697b24a46cf58e47753967d95 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 12 Aug 2015 21:32:41 +0100 Subject: Initial support for writing style maps to docx files --- tests/mammoth.tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index ad7a058..41a3a22 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -80,6 +80,21 @@ describe('mammoth', function() { }); }); + test('style map can be saved and read from document buffer', function() { + var docxPath = path.join(__dirname, "test-data/single-paragraph.docx"); + return promises.nfcall(fs.readFile, docxPath) + .then(function(buffer) { + return mammoth.writeStyleMapToDocx({buffer: buffer, styleMap: "p => h1"}); + }) + .then(function(docx) { + return mammoth.convertToHtml({buffer: docx.toBuffer()}); + }) + .then(function(result) { + assert.equal(result.value, "

Walking on imported air

"); + assert.deepEqual(result.messages, []); + }); + }); + test('options are passed to document converter when calling mammoth.convertToHtml', function() { var docxFile = createFakeDocxFile({ "word/document.xml": testData("simple/word/document.xml") -- cgit v1.2.3