From e5e37a6f2cfa04e146d534028fbf291aac2a9fe2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 7 Sep 2015 20:04:58 +0100 Subject: Add support for external images --- tests/testing.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'tests/testing.js') diff --git a/tests/testing.js b/tests/testing.js index b8757c9..d70f86e 100644 --- a/tests/testing.js +++ b/tests/testing.js @@ -7,6 +7,7 @@ exports.test = test; exports.testPath = testPath; exports.testData = testData; exports.createFakeDocxFile = createFakeDocxFile; +exports.createFakeFiles = createFakeFiles; function test(name, func) { @@ -28,6 +29,23 @@ function testData(testDataPath) { } function createFakeDocxFile(files) { + function exists(path) { + return !!files[path]; + } + + return { + read: createRead(files), + exists: exists + }; +} + +function createFakeFiles(files) { + return { + read: createRead(files) + }; +} + +function createRead(files) { function read(path, encoding) { return promises.when(files[path], function(buffer) { if (_.isString(buffer)) { @@ -43,13 +61,5 @@ function createFakeDocxFile(files) { } }); } - - function exists(path) { - return !!files[path]; - } - - return { - read: read, - exists: exists - }; + return read; } -- cgit v1.2.3