diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/docx/files.tests.js | 24 | ||||
| -rw-r--r-- | tests/test-data/tiny-picture.png | bin | 0 -> 110 bytes |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/docx/files.tests.js b/tests/docx/files.tests.js new file mode 100644 index 0000000..d3f3391 --- /dev/null +++ b/tests/docx/files.tests.js @@ -0,0 +1,24 @@ +var path = require("path"); +var fs = require("fs"); +var assert = require("assert"); + +var promises = require("../../lib/promises"); +var Files = require("../../lib/docx/files").Files; + +var testing = require("../testing"); +var test = testing.test; + +var readFile = promises.promisify(fs.readFile.bind(fs)); + + +describe("Files", function() { + test("can open files with file URI", function() { + var filePath = path.resolve(testing.testPath("tiny-picture.png")); + var files = new Files(null); + return files.read("file:///" + filePath.replace(/^\//, ""), "base64").then(function(contents) { + return readFile(filePath, "base64").then(function(expectedContents) { + assert.deepEqual(contents, expectedContents); + }); + }); + }); +}); diff --git a/tests/test-data/tiny-picture.png b/tests/test-data/tiny-picture.png Binary files differnew file mode 100644 index 0000000..74cb4ba --- /dev/null +++ b/tests/test-data/tiny-picture.png |
