From 6d26a75c4622f481a8c24fe27b5db1191c7b2f0f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 16 Aug 2015 14:06:35 +0100 Subject: Add tests for embedding and reading style maps --- tests/docx/style-map.tests.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/docx/style-map.tests.js diff --git a/tests/docx/style-map.tests.js b/tests/docx/style-map.tests.js new file mode 100644 index 0000000..a14ffb3 --- /dev/null +++ b/tests/docx/style-map.tests.js @@ -0,0 +1,26 @@ +var assert = require("assert"); + +var JSZip = require("jszip"); + +var zipfile = require("../../lib/zipfile"); +var styleMap = require("../../lib/docx/style-map"); +var test = require("../testing").test; + +describe("zipfile", function() { + test('embedded style map can be read after being written', function() { + var zip = emptyZipFile(); + + styleMap.writeStyleMap(zip, "p => h1"); + + return styleMap.readStyleMap(zip).then(function(contents) { + assert.equal(contents, "p => h1"); + }); + }); +}); + +function emptyZipFile() { + var zip = new JSZip(); + var buffer = zip.generate({type: "arraybuffer"}); + return zipfile.openArrayBuffer(buffer); +} + -- cgit v1.2.3