aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-08-16 17:08:33 +0100
committerMichael Williamson <mike@zwobble.org>2015-08-16 17:08:33 +0100
commit92d74192ae0c014b7b7d9d648f8305745433e4c2 (patch)
tree8d70994716d587ea549f313bf9c29151d5cbb2d4 /tests
parent42ea88fd99174ec0b86a71d5cd18244ea22dcadd (diff)
Add mammoth.readEmbeddedStyleMap
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth.tests.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 10ba228..b7f4766 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -81,7 +81,7 @@ describe('mammoth', function() {
});
});
- test('embedded style is used if present', function() {
+ test('embedded style map is used if present', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
return promises.nfcall(fs.readFile, docxPath)
.then(function(buffer) {
@@ -96,6 +96,20 @@ describe('mammoth', function() {
});
});
+ test('embedded style map can be retrieved', function() {
+ var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+ return promises.nfcall(fs.readFile, docxPath)
+ .then(function(buffer) {
+ return mammoth.embedStyleMap({buffer: buffer}, "p => h1");
+ })
+ .then(function(docx) {
+ return mammoth.readEmbeddedStyleMap({buffer: docx.toBuffer()});
+ })
+ .then(function(styleMap) {
+ assert.equal(styleMap, "p => h1");
+ });
+ });
+
test('warning if style mapping is not understood', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
var options = {