aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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 = {