aboutsummaryrefslogtreecommitdiff
path: root/tests/testing.js
diff options
context:
space:
mode:
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;
}