summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-09-06 17:43:29 +0100
committerMichael Williamson <mike@zwobble.org>2015-09-06 17:46:16 +0100
commitf16aeec2396f78cc3cedcaafa5d58899408ffb99 (patch)
treeb22834c594871c32ab85b0a7135dc3aa35b028be /tests
parent854682f7fcc4c68034b1174f461558840f39a7bf (diff)
Allow localhost in file:/// URIs
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/files.tests.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/docx/files.tests.js b/tests/docx/files.tests.js
index a21bc93..0ec64e1 100644
--- a/tests/docx/files.tests.js
+++ b/tests/docx/files.tests.js
@@ -33,4 +33,12 @@ describe("uriToPath", function() {
test("URI is unquoted", function() {
assert.equal(uriToPath("file:///a%20b"), "/a b");
});
+
+ test("when host is set to localhost then path can be found", function() {
+ assert.equal(uriToPath("file://localhost/a/b/c"), "/a/b/c");
+ });
+
+ test("when host is set but not localhost then path cannot be found", function() {
+ assert.throws(function() { uriToPath("file://example/a/b/c"); }, /Could not convert URI to path: file:\/\/example\/a\/b\/c/);
+ });
});