Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rook2pawn committed Aug 15, 2011
1 parent 1e8c7c6 commit 2f7eacb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test.js
Expand Up @@ -57,6 +57,7 @@ exports.testGovernor = function(test) {
test.equals('dog meows?',outstring);
test.done();
};
// test that the global work function is in effect
exports.testGlobalWorkFunction = function(test) {
test.expect(1);
var myResults = [];
Expand All @@ -68,6 +69,7 @@ exports.testGlobalWorkFunction = function(test) {
test.deepEqual(['AARDVARK','BAT','CAT','DOG'],myResults);
test.done();
};
// test that noDeleteOnNext flag is working
exports.testNoDeleteOnNext = function(test) {
test.expect(1);
var myQueue = [];
Expand All @@ -80,3 +82,24 @@ exports.testNoDeleteOnNext = function(test) {
test.deepEqual([['aardvark'],['bat'],['cat'],['dog']],myQueue);
test.done();
};

// test that the transform on push function is working
exports.testTransform = function (test) {
test.expect(3);
var q = qlib().transform(function(el) {
return {el:el, firstLetter:el.slice(0,1)}
});
q.push('aardvark',function(el,lib) {
test.deepEqual({el:'aardvark',firstLetter:'a'},el);
lib.done();
});
q.push('bat',function(el,lib) {
test.deepEqual({el:'bat',firstLetter:'b'},el);
lib.done();
});
q.push('cat',function(el,lib) {
test.deepEqual({el:'cat',firstLetter:'c'},el);
lib.done();
});
test.done();
};

0 comments on commit 2f7eacb

Please sign in to comment.