From c127f0d75175d2ab06682bac1bb22dcf31de2b81 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 30 Mar 2013 22:14:12 +0000 Subject: Add test for docx-reader --- tests/testing.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/testing.js') diff --git a/tests/testing.js b/tests/testing.js index 0e371d9..f2cf55a 100644 --- a/tests/testing.js +++ b/tests/testing.js @@ -1,7 +1,11 @@ +var path = require("path"); +var fs = require("fs"); var q = require("q"); - exports.test = test; +exports.testData = testData; +exports.createFakeDocxFile = createFakeDocxFile; + function test(name, func) { it(name, function(done) { @@ -11,3 +15,18 @@ function test(name, func) { }).done(); }); } + +function testData(testDataPath) { + var fullPath = path.join(__dirname, "test-data", testDataPath); + return q.nfcall(fs.readFile, fullPath, "utf-8"); +} + +function createFakeDocxFile(files) { + function read(path) { + return files[path]; + } + + return { + read: read + }; +} -- cgit v1.2.3