1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Exchange queue with a better one

This commit is contained in:
Ruben Bridgewater
2015-10-04 22:35:17 +02:00
parent e0b9f0de79
commit 2232a8948e
6 changed files with 9 additions and 104 deletions

View File

@@ -1,39 +0,0 @@
'use strict';
var assert = require("assert");
var Queue = require('../lib/queue');
describe('queue', function () {
var q = new Queue();
describe('push', function () {
it('places values on end of queue', function () {
q.push('a');
q.push(3);
assert.equal(q.length, 2);
});
});
describe('shift', function () {
it('removes values from front of queue', function () {
assert.equal(q.shift(), 'a');
});
});
describe('forEach', function () {
it('iterates over values in queue', function () {
q.forEach(function (v) {
assert.equal(v, 3);
});
});
});
describe('forEachWithScope', function () {
it('provides a scope to the iteration function', function () {
q.forEach(function (v) {
assert.equal(this.foo, 'bar');
assert.equal(v, 3);
}, {foo: 'bar'});
});
});
});