aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/files.tests.js24
-rw-r--r--tests/test-data/tiny-picture.pngbin0 -> 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
new file mode 100644
index 0000000..74cb4ba
--- /dev/null
+++ b/tests/test-data/tiny-picture.png
Binary files differ