Created
October 29, 2011 23:21
-
-
Save BryanDonovan/1325226 to your computer and use it in GitHub Desktop.
Failing unit test for nodeunit issue #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.nestedTestCases = function (test) { | |
var call_order = []; | |
var s = { | |
setUp: function (callback) { | |
call_order.push('setUp'); | |
callback(); | |
}, | |
tearDown: function (callback) { | |
call_order.push('tearDown'); | |
callback(); | |
}, | |
test1: function (test) { | |
call_order.push('test1'); | |
test.done(); | |
}, | |
group1: { | |
setUp: function (callback) { | |
call_order.push('group1.setUp'); | |
callback(); | |
}, | |
tearDown: function (callback) { | |
call_order.push('group1.tearDown'); | |
callback(); | |
}, | |
test2: function (test) { | |
call_order.push('group1.test2'); | |
test.done(); | |
}, | |
group2: { | |
setUp: function (callback) { | |
call_order.push('group2.setUp'); | |
callback(); | |
}, | |
tearDown: function (callback) { | |
call_order.push('group2.tearDown'); | |
callback(); | |
}, | |
test3: function (test) { | |
call_order.push('group2.test3'); | |
test.done(); | |
} | |
} | |
} | |
}; | |
nodeunit.runSuite(null, s, {}, function (err, assertions) { | |
test.same(call_order, [ | |
'setUp', | |
'test1', | |
'tearDown', | |
'setUp', | |
'group1.setUp', | |
'group1.test2', | |
'group1.tearDown', | |
'tearDown', | |
'setUp', | |
'group1.setUp', | |
'group2.setUp', | |
'group2.test3', | |
'group2.tearDown', | |
'group1.tearDown', | |
'tearDown' | |
]); | |
test.done(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment