Deprecate getResults() (use results()). Add some unit test coverage for jasmine.Spec. Add some unit test coverage for JsApiReporterSpec.
This commit is contained in:
@@ -67,13 +67,13 @@ describe("jasmine spec running", function () {
|
||||
|
||||
expect(specWithNoBody.description).toEqual('new spec');
|
||||
|
||||
expect(specWithExpectation.results.getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
||||
expect(specWithExpectation.results.getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
||||
expect(specWithExpectation.results.description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
||||
expect(specWithExpectation.results().getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
||||
expect(specWithExpectation.results().getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
||||
expect(specWithExpectation.results().description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
||||
|
||||
expect(specWithFailingExpectations.results.getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
||||
expect(specWithFailingExpectations.results().getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
||||
|
||||
expect(specWithMultipleExpectations.results.getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
||||
expect(specWithMultipleExpectations.results().getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
||||
});
|
||||
|
||||
it("should work without a runs block", function() {
|
||||
@@ -89,10 +89,10 @@ describe("jasmine spec running", function () {
|
||||
another_spec.execute();
|
||||
another_spec.done = true;
|
||||
|
||||
expect(another_spec.results.getItems().length).toEqual(2);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
||||
expect(another_spec.results.getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
||||
expect(another_spec.results.description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
||||
expect(another_spec.results().getItems().length).toEqual(2);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
||||
expect(another_spec.results().getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
||||
expect(another_spec.results().description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
||||
});
|
||||
|
||||
it('should queue waits and runs that it encounters while executing specs', function() {
|
||||
@@ -141,8 +141,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
a_spec.execute();
|
||||
|
||||
expect(a_spec.results.getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
||||
expect(a_spec.results().getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
||||
|
||||
foo = 0;
|
||||
env.describe('test async spec', function() {
|
||||
@@ -161,15 +161,15 @@ describe("jasmine spec running", function () {
|
||||
|
||||
a_spec.execute();
|
||||
|
||||
expect(a_spec.results.getItems().length).toEqual(0);
|
||||
expect(a_spec.results().getItems().length).toEqual(0);
|
||||
|
||||
fakeTimer.tick(500);
|
||||
expect(a_spec.results.getItems().length).toEqual(0);
|
||||
expect(a_spec.results().getItems().length).toEqual(0);
|
||||
|
||||
fakeTimer.tick(500);
|
||||
expect(a_spec.results.getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results().getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
||||
|
||||
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
||||
|
||||
var bar = 0;
|
||||
var another_spec;
|
||||
@@ -199,8 +199,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
fakeTimer.tick(1000);
|
||||
|
||||
expect(another_spec.results.getItems().length).toEqual(1);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||
expect(another_spec.results().getItems().length).toEqual(1);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
||||
|
||||
var baz = 0;
|
||||
var yet_another_spec;
|
||||
@@ -225,8 +225,8 @@ describe("jasmine spec running", function () {
|
||||
fakeTimer.tick(150);
|
||||
|
||||
|
||||
expect(yet_another_spec.results.getItems().length).toEqual(1);
|
||||
expect(yet_another_spec.results.getItems()[0].passed()).toEqual(false);
|
||||
expect(yet_another_spec.results().getItems().length).toEqual(1);
|
||||
expect(yet_another_spec.results().getItems()[0].passed()).toEqual(false);
|
||||
});
|
||||
|
||||
it("testAsyncSpecsWithMockSuite", function () {
|
||||
@@ -254,8 +254,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
another_spec.execute();
|
||||
fakeTimer.tick(2000);
|
||||
expect(another_spec.results.getItems().length).toEqual(1);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||
expect(another_spec.results().getItems().length).toEqual(1);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
||||
});
|
||||
|
||||
it("testWaitsFor", function() {
|
||||
@@ -304,7 +304,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
spec.execute();
|
||||
fakeTimer.tick(1000);
|
||||
var actual = spec.results.getItems()[0].message;
|
||||
var actual = spec.results().getItems()[0].message;
|
||||
var expected = 'timeout: timed out after 500 msec waiting for my awesome condition';
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
@@ -334,7 +334,7 @@ describe("jasmine spec running", function () {
|
||||
expect(runsBlockExecuted).toEqual(false);
|
||||
fakeTimer.tick(400);
|
||||
expect(runsBlockExecuted).toEqual(false);
|
||||
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';
|
||||
expect(actual).toEqual(expected,
|
||||
'expected "' + expected + '" but found "' + actual + '"');
|
||||
@@ -425,8 +425,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
var suite = suiteWithBefore;
|
||||
|
||||
expect(suite.getResults().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
||||
expect(suite.getResults().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
||||
expect(suite.results().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
||||
expect(suite.results().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
||||
|
||||
|
||||
var foo = 1;
|
||||
@@ -453,8 +453,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
suite = suiteWithAfter;
|
||||
expect(suite.afterEach.length).toEqual(1);
|
||||
expect(suite.getResults().getItems()[0].passed()).toEqual(true);
|
||||
expect(suite.getResults().getItems()[1].passed()).toEqual(true);
|
||||
expect(suite.results().getItems()[0].passed()).toEqual(true);
|
||||
expect(suite.results().getItems()[1].passed()).toEqual(true);
|
||||
expect(foo).toEqual(0);
|
||||
|
||||
});
|
||||
@@ -809,7 +809,7 @@ describe("jasmine spec running", function () {
|
||||
suite.execute();
|
||||
|
||||
expect(report).toEqual("firstsecond");
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||
expect(suiteResults.getItems()[1].getItems()[0].passed()).toEqual(true);
|
||||
});
|
||||
@@ -848,7 +848,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
expect(report).toEqual("firstsecondthird"); // "all tests should run");
|
||||
//After each errors should not go in spec results because it confuses the count.
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems().length).toEqual(3, 'testAfterExecutesSafely should have results for three specs');
|
||||
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 1st spec should pass");
|
||||
@@ -973,7 +973,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
env.execute();
|
||||
|
||||
var runnerResults = env.currentRunner.getResults();
|
||||
var runnerResults = env.currentRunner.results();
|
||||
expect(runnerResults.totalCount).toEqual(3);
|
||||
expect(runnerResults.passedCount).toEqual(3);
|
||||
expect(runnerResults.failedCount).toEqual(0);
|
||||
@@ -1011,7 +1011,7 @@ describe("jasmine spec running", function () {
|
||||
suite.execute();
|
||||
fakeTimer.tick(600);
|
||||
expect(spec.foo).toEqual(2);
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems()[0].getItems().length).toEqual(2);
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||
expect(suiteResults.getItems()[0].getItems()[1].passed()).toEqual(true);
|
||||
|
||||
Reference in New Issue
Block a user