Merged in Selenium optimizations from http://github.com/gannett/jasmine branch. Updated json2 to latest.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
describe('JsApiReporterSpec', function () {
|
||||
describe('jasmine.jsApiReporter', function() {
|
||||
|
||||
|
||||
describe('results', function () {
|
||||
var reporter, spec1, spec2, expectedSpec1Results, expectedSpec2Results;
|
||||
var reporter, spec1, spec2, spec3, expectedSpec1Results, expectedSpec2Results;
|
||||
|
||||
beforeEach(function() {
|
||||
var env = new jasmine.Env();
|
||||
var suite = new jasmine.Suite(env);
|
||||
spec1 = new jasmine.Spec(env, suite);
|
||||
spec1 = new jasmine.Spec(env, suite, 'spec 1');
|
||||
spec1.runs(function () {
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
@@ -15,7 +15,7 @@ describe('JsApiReporterSpec', function () {
|
||||
messages: spec1.results().getItems(),
|
||||
result: "passed"
|
||||
};
|
||||
spec2 = new jasmine.Spec(env, suite);
|
||||
spec2 = new jasmine.Spec(env, suite, 'spec 2');
|
||||
spec2.runs(function () {
|
||||
this.expect(true).toEqual(false);
|
||||
});
|
||||
@@ -24,12 +24,19 @@ describe('JsApiReporterSpec', function () {
|
||||
result: "failed"
|
||||
};
|
||||
|
||||
spec3 = new jasmine.Spec(env, suite, 'spec 3');
|
||||
spec3.runs(function () {
|
||||
this.log('some debug message')
|
||||
});
|
||||
|
||||
spec1.execute();
|
||||
spec2.execute();
|
||||
spec3.execute();
|
||||
|
||||
reporter = new jasmine.JsApiReporter();
|
||||
reporter.reportSpecResults(spec1);
|
||||
reporter.reportSpecResults(spec2);
|
||||
reporter.reportSpecResults(spec3);
|
||||
});
|
||||
|
||||
it('resultForSpec() should return the result for the given spec', function () {
|
||||
@@ -43,5 +50,32 @@ describe('JsApiReporterSpec', function () {
|
||||
expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results);
|
||||
});
|
||||
|
||||
describe("#summarizeResult_", function() {
|
||||
it("should summarize a passing result", function() {
|
||||
var result = reporter.results()[spec1.id];
|
||||
var summarizedResult = reporter.summarizeResult_(result);
|
||||
expect(summarizedResult.result).toEqual('passed');
|
||||
expect(summarizedResult.messages.length).toEqual(1);
|
||||
expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
|
||||
expect(summarizedResult.messages[0].passed).toBeTruthy();
|
||||
expect(summarizedResult.messages[0].type).toEqual('ExpectationResult');
|
||||
expect(summarizedResult.messages[0].text).toEqual(undefined);
|
||||
expect(summarizedResult.messages[0].trace.stack).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should have a stack trace for failing specs", function() {
|
||||
var result = reporter.results()[spec2.id];
|
||||
var summarizedResult = reporter.summarizeResult_(result);
|
||||
expect(summarizedResult.result).toEqual('failed');
|
||||
expect(summarizedResult.messages[0].trace.stack).toEqual(result.messages[0].trace.stack);
|
||||
});
|
||||
|
||||
it("should have messages for specs with messages", function() {
|
||||
var result = reporter.results()[spec3.id];
|
||||
var summarizedResult = reporter.summarizeResult_(result);
|
||||
expect(summarizedResult.result).toEqual('passed');
|
||||
expect(summarizedResult.messages[0].text).toEqual('some debug message');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user