You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
36 lines
641 B
JavaScript
36 lines
641 B
JavaScript
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();
|
|
}
|
|
}
|