diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-03-28 13:42:25 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-03-28 13:42:25 +0100 |
| commit | 7f0c1b221bd07a9ccb077c451050d40b57ef9405 (patch) | |
| tree | bf8368c8d33d3b4687d8f6c953a2c400ff4e610d | |
| parent | 0e65481fb1e1d09e9fb971c13073fcd1eef92303 (diff) | |
Loosen error message assertion when file not found
| -rw-r--r-- | tests/docx/files.tests.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/docx/files.tests.js b/tests/docx/files.tests.js index 65cd486..9f5bb38 100644 --- a/tests/docx/files.tests.js +++ b/tests/docx/files.tests.js @@ -43,7 +43,7 @@ describe("Files", function() { test("error if relative uri cannot be opened", function() { var files = new Files("/tmp"); return assertError(files.read("not-a-real-file.png", "base64"), function(err) { - assert.equal(err.message, "could not open external image: 'not-a-real-file.png' (document directory: '/tmp')\nENOENT, open '/tmp/not-a-real-file.png'"); + assertRegex(err.message, /could not open external image: 'not-a-real-file.png' \(document directory: '\/tmp'\)\nENOENT,.*'\/tmp\/not-a-real-file.png'.*/); }); }); }); @@ -54,6 +54,10 @@ function assertError(promise, func) { }, func); } +function assertRegex(actual, expected) { + assert.ok(expected.test(actual), "Expected regex: " + expected + "\nbut was: " + actual); +} + describe("uriToPath", function() { test("leading slash is retained on non-Windows file URIs", function() { |
