diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-08-16 14:06:35 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-08-16 14:06:35 +0100 |
| commit | 6d26a75c4622f481a8c24fe27b5db1191c7b2f0f (patch) | |
| tree | c1b85ab6bceb7c7bc5b08d331fc864929f7fced1 | |
| parent | 024d8735f21ae0d0e0e82d15b79db3ceac027d16 (diff) | |
Add tests for embedding and reading style maps
| -rw-r--r-- | tests/docx/style-map.tests.js | 26 |
1 files changed, 26 insertions, 0 deletions
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); +} + |
