aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth.tests.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 9e81a84..fe5d72a 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -1,5 +1,8 @@
var assert = require("assert");
var path = require("path");
+var fs = require("fs");
+
+var q = require("q");
var mammoth = require("../")
var htmlPaths = require("../lib/html-paths");
@@ -19,6 +22,21 @@ describe('mammoth', function() {
});
});
+ test('should convert Uint8Array containing one one paragraph to single p element', function() {
+ var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+
+ return q.nfcall(fs.readFile, docxPath).then(function(buffer) {
+ var array = new Uint8Array(buffer.length);
+ for (var i = 0; i < buffer.length; i++) {
+ array[i] = buffer[i];
+ }
+ var converter = new mammoth.Converter();
+ return converter.convertToHtml({uint8Array: array}).then(function(result) {
+ assert.equal("<p>Walking on imported air</p>", result.html);
+ });
+ });
+ });
+
test('options are passed to document converter', function() {
var docxFile = createFakeDocxFile({
"word/document.xml": testData("simple/word/document.xml")