2009-05-29 03:02:15 +00:00
|
|
|
describe('jasmine.NestedResults', function() {
|
|
|
|
it('#addResult increments counters', function() {
|
|
|
|
// Leaf case
|
|
|
|
var results = new jasmine.NestedResults();
|
|
|
|
|
2009-08-19 14:42:47 +00:00
|
|
|
results.addResult(new jasmine.ExpectationResult(true,'Passed.'));
|
2009-05-29 03:02:15 +00:00
|
|
|
|
|
|
|
expect(results.getItems().length).toEqual(1);
|
|
|
|
expect(results.totalCount).toEqual(1);
|
|
|
|
expect(results.passedCount).toEqual(1);
|
|
|
|
expect(results.failedCount).toEqual(0);
|
|
|
|
|
2009-08-19 14:42:47 +00:00
|
|
|
results.addResult(new jasmine.ExpectationResult(false, 'FAIL.'));
|
2009-05-29 03:02:15 +00:00
|
|
|
|
|
|
|
expect(results.getItems().length).toEqual(2);
|
|
|
|
expect(results.totalCount).toEqual(2);
|
|
|
|
expect(results.passedCount).toEqual(1);
|
|
|
|
expect(results.failedCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should roll up counts for nested results', function() {
|
|
|
|
// Branch case
|
|
|
|
var leafResultsOne = new jasmine.NestedResults();
|
2009-08-19 14:42:47 +00:00
|
|
|
leafResultsOne.addResult(new jasmine.ExpectationResult( true, ''));
|
|
|
|
leafResultsOne.addResult(new jasmine.ExpectationResult( false, ''));
|
2009-05-29 03:02:15 +00:00
|
|
|
|
|
|
|
var leafResultsTwo = new jasmine.NestedResults();
|
2009-08-19 14:42:47 +00:00
|
|
|
leafResultsTwo.addResult(new jasmine.ExpectationResult( true, ''));
|
|
|
|
leafResultsTwo.addResult(new jasmine.ExpectationResult( false, ''));
|
2009-05-29 03:02:15 +00:00
|
|
|
|
|
|
|
var branchResults = new jasmine.NestedResults();
|
|
|
|
branchResults.addResult(leafResultsOne);
|
|
|
|
branchResults.addResult(leafResultsTwo);
|
|
|
|
|
|
|
|
expect(branchResults.getItems().length).toEqual(2);
|
|
|
|
expect(branchResults.totalCount).toEqual(4);
|
|
|
|
expect(branchResults.passedCount).toEqual(2);
|
|
|
|
expect(branchResults.failedCount).toEqual(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|