Browse files

Updated tests

  • Loading branch information...
1 parent 1e8c7c6 commit 2f7eacb56582a584673db81b6e3b45ab8b24815f @rook2pawn committed Aug 15, 2011
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/test.js
View
23 test/test.js
@@ -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 = [];
@@ -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 = [];
@@ -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.