From 2596c1c7122096874d00d7c5392d4ffb482e31b6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 7 Sep 2015 20:39:54 +0100 Subject: Continue with warning when failing to read image --- tests/docx/files.tests.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/docx') diff --git a/tests/docx/files.tests.js b/tests/docx/files.tests.js index e37df6b..a00b60b 100644 --- a/tests/docx/files.tests.js +++ b/tests/docx/files.tests.js @@ -32,8 +32,21 @@ describe("Files", function() { }); }); }); + + test("given base is not set when opening relative uri then error is raised", function() { + var files = new Files(null); + return assertError(files.read("not-a-real-file.png", "base64"), function(err) { + assert.equal(err.message, "could not find external image 'not-a-real-file.png', path of input document is unknown"); + }); + }); }); +function assertError(promise, func) { + return promise.then(function() { + assert(false, "Expected error"); + }, func); +} + describe("uriToPath", function() { test("leading slash is retained on non-Windows file URIs", function() { -- cgit v1.2.3