aboutsummaryrefslogtreecommitdiff
path: root/tests/testing.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-09-07 20:04:58 +0100
committerMichael Williamson <mike@zwobble.org>2015-09-07 20:04:58 +0100
commite5e37a6f2cfa04e146d534028fbf291aac2a9fe2 (patch)
tree82f731589d4534b51b2dd1caf4b51848c0468eb1 /tests/testing.js
parent97144ee9f557ef4886456972d36583b6b62685d2 (diff)
Add support for external images
Diffstat (limited to 'tests/testing.js')
-rw-r--r--tests/testing.js28
1 files changed, 19 insertions, 9 deletions
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;
}