Add test coverage for empty suite handling

This commit is contained in:
ragaskar 2009-08-20 19:32:15 -07:00
parent 96bcde80af
commit 9b9a4b6835
1 changed files with 43 additions and 14 deletions

View File

@ -341,7 +341,7 @@ describe("jasmine spec running", function () {
var actual = spec.results.getItems()[0].message; var actual = spec.results.getItems()[0].message;
var expected = 'timeout: timed out after 500 msec waiting for something to happen'; var expected = 'timeout: timed out after 500 msec waiting for something to happen';
expect(actual).toEqual(expected, expect(actual).toEqual(expected,
'expected "' + expected + '" but found "' + actual + '"'); 'expected "' + expected + '" but found "' + actual + '"');
}); });
it("testSpecAfter", function() { it("testSpecAfter", function() {
@ -510,8 +510,8 @@ describe("jasmine spec running", function () {
}); });
env.it('should run tests following nested suites', function () { env.it('should run tests following nested suites', function () {
quux++; quux++;
}); });
}); });
expect(foo).toEqual(0); expect(foo).toEqual(0);
@ -711,7 +711,7 @@ describe("jasmine spec running", function () {
this.after(function () { this.after(function () {
this.waits(500); this.waits(500);
this.runs(function () { this.runs(function () {
afterHasRun = true; afterHasRun = true;
}); });
this.waits(500); this.waits(500);
}, true); }, true);
@ -791,7 +791,7 @@ describe("jasmine spec running", function () {
expect(firstSpecHasRun).toEqual(true); expect(firstSpecHasRun).toEqual(true);
expect(secondSpecHasRun).toEqual(true); expect(secondSpecHasRun).toEqual(true);
}); });
it("testBeforeExecutesSafely", function() { it("testBeforeExecutesSafely", function() {
var report = ""; var report = "";
@ -965,6 +965,35 @@ describe("jasmine spec running", function () {
expect(nestedSpec.getFullName()).toEqual('Test Subject when under circumstance A and circumstance B behaves thusly.'); //, "Spec.fullName was incorrect: " + nestedSpec.getFullName()); expect(nestedSpec.getFullName()).toEqual('Test Subject when under circumstance A and circumstance B behaves thusly.'); //, "Spec.fullName was incorrect: " + nestedSpec.getFullName());
}); });
it("should skip empty suites", function () {
env.describe('NonEmptySuite1', function() {
env.it('should pass', function() {
this.expect(true).toEqual(true);
});
env.describe('NestedEmptySuite', function() {
});
env.it('should pass', function() {
this.expect(true).toEqual(true);
});
});
env.describe('EmptySuite', function() {});
env.describe('NonEmptySuite2', function() {
env.it('should pass', function() {
this.expect(true).toEqual(true);
});
});
env.execute();
fakeTimer.tick(0);
var runnerResults = env.currentRunner.getResults();
expect(runnerResults.totalCount).toEqual(3);
expect(runnerResults.passedCount).toEqual(3);
expect(runnerResults.failedCount).toEqual(0);
});
it("should bind 'this' to the running spec within the spec body", function() { it("should bind 'this' to the running spec within the spec body", function() {
var spec; var spec;
var suite = env.describe('one suite description', function () { var suite = env.describe('one suite description', function () {