Permalink
Browse files

More dogfood test cases

  • Loading branch information...
joelplane committed Jun 12, 2011
1 parent 19ab22b commit 2e881ed0c44fc34b0e3cde49c2c05c52cf16ebd1
Showing with 52 additions and 0 deletions.
  1. +52 −0 noodleTestTest.js
View
@@ -1,4 +1,5 @@
var test = require('./noodleTest')();
+var EventEmitter = require('events').EventEmitter;
test.onFailureExitNonZero();
test.context("NoodleTest dogfood test", function() {
@@ -46,4 +47,55 @@ test.context("NoodleTest dogfood test", function() {
});
+ this.it("should keep Assertion in test's failed array if an assertion fails", function(done) {
+ var myThis = this;
+
+ var ee = new EventEmitter();
+
+ var t = require('./noodleTest')({quiet: true});
+
+ ee.on('setupDone', function(test){
+ myThis.assert(test.failures.length > 0);
+ myThis.assert(test.passes.length == 0);
+ done();
+ });
+
+ t.context("test context", function() {
+ this.it("test1", function(done2){
+ this.assert(false);
+ done2();
+ ee.emit('setupDone', this);
+ });
+ });
+
+ });
+
+ this.it("should emit assertionFailed event when an assertion fails", function(done) {
+ var myThis = this;
+
+ var seenAssertionFailedEvent = false;
+ var finish = function() {
+ myThis.assert(seenAssertionFailedEvent);
+ done();
+ };
+
+ var t = require('./noodleTest')({quiet: true});
+ var timer = setTimeout(function(){
+ finish();
+ }, 200);
+ t.on('assertionFailed', function() {
+ seenAssertionFailedEvent = true;
+ clearTimeout(timer);
+ finish();
+ });
+
+ t.context("test context", function() {
+ this.it("test1", function(done2){
+ this.assert(false);
+ done2();
+ });
+ });
+
+ });
+
});

0 comments on commit 2e881ed

Please sign in to comment.