1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00

making an attempt to improve the test suite

This commit is contained in:
Benjamin Coe
2015-07-11 16:14:42 -07:00
parent b92a62d643
commit d30e80abbe
8 changed files with 92 additions and 35 deletions

35
test/queue-test.js Normal file
View File

@@ -0,0 +1,35 @@
var assert = require("assert");
var Queue = require('../lib/queue');
module.exports = function (tests, next) {
var q = new Queue();
tests.push = function () {
q.push('a');
q.push(3);
assert.equal(q.length, 2);
return next();
}
tests.shift = function () {
assert.equal(q.shift(), 'a');
return next();
}
tests.forEach = function () {
q.forEach(function (v) {
assert.equal(v, 3);
});
return next();
}
tests.forEachWithScope = function () {
q.forEach(function (v) {
assert.equal(this.foo, 'bar');
assert.equal(v, 3);
}, {foo: 'bar'});
return next();
}
}