aboutsummaryrefslogtreecommitdiff
path: root/tests/testing.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-03-06 11:06:43 +0000
committerMichael Williamson <mike@zwobble.org>2014-03-06 11:06:43 +0000
commitf5b9b1c8632de9f2066bc45ded336d1e04e64aab (patch)
treec2351d3052b1bb3fc0f0d470be1786100303113e /tests/testing.js
parent85e30f452001b5d02a617da21c72e12b206dfdb4 (diff)
Use bluebird instead of q for better performance
Diffstat (limited to 'tests/testing.js')
-rw-r--r--tests/testing.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/testing.js b/tests/testing.js
index 6fef626..57bcb7e 100644
--- a/tests/testing.js
+++ b/tests/testing.js
@@ -1,6 +1,6 @@
var path = require("path");
var fs = require("fs");
-var q = require("q");
+var promises = require("../lib/promises");
var _ = require("underscore");
exports.test = test;
@@ -11,7 +11,7 @@ exports.createFakeDocxFile = createFakeDocxFile;
function test(name, func) {
it(name, function(done) {
var result = func();
- q.when(result).then(function() {
+ promises.when(result).then(function() {
done()
}).done();
});
@@ -19,22 +19,22 @@ function test(name, func) {
function testData(testDataPath) {
var fullPath = path.join(__dirname, "test-data", testDataPath);
- return q.nfcall(fs.readFile, fullPath, "utf-8");
+ return promises.nfcall(fs.readFile, fullPath, "utf-8");
}
function createFakeDocxFile(files) {
function read(path, encoding) {
- return q.when(files[path], function(buffer) {
+ return promises.when(files[path], function(buffer) {
if (_.isString(buffer)) {
buffer = new Buffer(buffer);
}
if (!Buffer.isBuffer(buffer)) {
- return q.reject(new Error("file was not a buffer"));
+ return promises.reject(new Error("file was not a buffer"));
} else if (encoding) {
- return q.when(buffer.toString(encoding));
+ return promises.when(buffer.toString(encoding));
} else {
- return q.when(buffer);
+ return promises.when(buffer);
}
});
}