Permalink
Browse files

More dogfood tests

  • Loading branch information...
1 parent 019d281 commit dc9fb065a697cef5aa2d58754d39cf148896e830 @joelplane joelplane committed Jun 12, 2011
Showing with 95 additions and 72 deletions.
  1. +95 −72 noodleTestTest.js
View
@@ -5,101 +5,124 @@ test.onFailureExitNonZero();
test.context("NoodleTest dogfood test", function() {
- this.it("should call the first context callback", function(done) {
- var t = require('./noodleTest')({quiet: true});
- t.context("test context", function() {
- done();
- this.it("test test", function(done2){
- done2();
+ this.context('Basic Execution', function() {
+ this.it("should call the first context callback", function(done) {
+ var t = require('./noodleTest')({quiet: true});
+ t.context("test context", function() {
+ done();
+ this.it("test test", function(done2){
+ done2();
+ });
});
- });
- });
+ });
- this.it("should call the first test callback", function(done) {
+ this.it("should call the first test callback", function(done) {
- var t = require('./noodleTest')({quiet: true});
- t.context("test context", function() {
- this.it("test test", function(done2){
- done();
- done2();
+ var t = require('./noodleTest')({quiet: true});
+ t.context("test context", function() {
+ this.it("test test", function(done2){
+ done();
+ done2();
+ });
});
- });
- });
+ });
- this.it("should call the second context callback after the first", function(done) {
- var myThis = this;
+ this.it("should call the second context callback after the first", function(done) {
+ var myThis = this;
- var firstCalled = false;
- var t = require('./noodleTest')({quiet: true});
- t.context("test context", function() {
- firstCalled = true;
- this.it("test1", function(done2){
- done2();
+ var firstCalled = false;
+ var t = require('./noodleTest')({quiet: true});
+ t.context("test context", function() {
+ firstCalled = true;
+ this.it("test1", function(done2){
+ done2();
+ });
});
- });
- t.context("test context", function() {
- myThis.assert(firstCalled);
- done();
- this.it("test1", function(done2){
- done2();
+ t.context("test context", function() {
+ myThis.assert(firstCalled);
+ done();
+ this.it("test1", function(done2){
+ done2();
+ });
});
- });
+ });
+
+ this.it("should call the second test callback after the first", function(done) {
+ var myThis = this;
+
+ var firstCalled = false;
+ var t = require('./noodleTest')({quiet: true});
+ t.context("test context", function() {
+ this.it("test 1", function(done2){
+ firstCalled = true;
+ done2();
+ });
+ this.it("test 1", function(done2){
+ myThis.assert(firstCalled);
+ done();
+ done2();
+ });
+ });
+
+ });
});
- this.it("should keep Assertion in test's failed array if an assertion fails", function(done) {
- var myThis = this;
+ this.context('Assertions', 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 ee = new EventEmitter();
- var t = require('./noodleTest')({quiet: true});
+ var t = require('./noodleTest')({quiet: true});
- ee.on('setupDone', function(test){
- myThis.assert(test.failures.length > 0);
- myThis.assert(test.passes.length == 0);
- done();
- });
+ 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);
+ 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;
- 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();
+ 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();
+ });
+ });
+
+ });
});
- this.context('stack trace', function() {
+ this.context('Stack trace', function() {
this.it("should be trimmed such that the first line is the client code", function(done) {
var myThis = this;

0 comments on commit dc9fb06

Please sign in to comment.