You've already forked node-redis
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:
35
test/queue-test.js
Normal file
35
test/queue-test.js
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user