diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-11 20:21:10 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-11 20:21:10 +0100 |
| commit | 1d9da5d8ed67e3f31ebda8f12082e6e607c673f0 (patch) | |
| tree | 379df4a95ecafbae772d8053e5a96b2fb90e73d1 /tests | |
| parent | c57b900666a82b4ccce033a923e53906255078c0 (diff) | |
Allow Uint8Array to be input for conversion
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mammoth.tests.js | 18 |
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") |
