Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2e51999

Browse files
committed
Rename deprecated wasCalled() -> toHaveBeenCalled() in all specs
As well as wasNotCalled(), wasCalledWith(), wasNotCalledWith()
1 parent b2f5299 commit 2e51999

10 files changed

+36
-36
lines changed

test/BrowserSpecs.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ describe('browser', function(){
5959
it('should process callbacks immedietly with no outstanding requests', function(){
6060
var callback = jasmine.createSpy('callback');
6161
browser.notifyWhenNoOutstandingRequests(callback);
62-
expect(callback).wasCalled();
62+
expect(callback).toHaveBeenCalled();
6363
});
6464

6565
it('should queue callbacks with outstanding requests', function(){
6666
var callback = jasmine.createSpy('callback');
6767
browser.xhr('GET', '/url', null, noop);
6868
browser.notifyWhenNoOutstandingRequests(callback);
69-
expect(callback).not.wasCalled();
69+
expect(callback).not.toHaveBeenCalled();
7070

7171
xhr.readyState = 4;
7272
xhr.onreadystatechange();
73-
expect(callback).wasCalled();
73+
expect(callback).toHaveBeenCalled();
7474
});
7575
});
7676

@@ -83,7 +83,7 @@ describe('browser', function(){
8383
log += code + ':' + data + ';';
8484
});
8585
browser.notifyWhenNoOutstandingRequests(callback);
86-
expect(callback).not.wasCalled();
86+
expect(callback).not.toHaveBeenCalled();
8787
expect(scripts.length).toEqual(1);
8888
var script = scripts[0];
8989
script.remove = function(){
@@ -93,7 +93,7 @@ describe('browser', function(){
9393
expect(url[0]).toEqual('http://example.org/path');
9494
expect(typeof fakeWindow[url[1]]).toEqual($function);
9595
fakeWindow[url[1]]('data');
96-
expect(callback).wasCalled();
96+
expect(callback).toHaveBeenCalled();
9797
expect(log).toEqual('remove();200:data;');
9898
expect(typeof fakeWindow[url[1]]).toEqual('undefined');
9999
});
@@ -172,10 +172,10 @@ describe('browser', function(){
172172
it('should update outstandingRequests counter', function() {
173173
var callback = jasmine.createSpy('callback');
174174
browser.defer(callback);
175-
expect(callback).not.wasCalled();
175+
expect(callback).not.toHaveBeenCalled();
176176

177177
fakeSetTimeout.flush();
178-
expect(callback).wasCalled();
178+
expect(callback).toHaveBeenCalled();
179179
});
180180
});
181181

test/JsonSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ describe('json', function(){
140140
var spy = this.spyOn(JSON, 'parse').andCallThrough();
141141

142142
expect(fromJson('{}')).toEqual({});
143-
expect(spy).wasNotCalled();
143+
expect(spy).not.toHaveBeenCalled();
144144

145145
expect(fromJson('{}', true)).toEqual({});
146-
expect(spy).wasCalled();
146+
expect(spy).toHaveBeenCalled();
147147
});
148148

149149

test/ResourceSpec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,21 @@ describe("resource", function() {
7878

7979
var cc = CreditCard.save({name:'misko'}, callback);
8080
nakedExpect(cc).toEqual({name:'misko'});
81-
expect(callback).wasNotCalled();
81+
expect(callback).not.toHaveBeenCalled();
8282
xhr.flush();
8383
nakedExpect(cc).toEqual({id:123, name:'misko'});
84-
expect(callback).wasCalledWith(cc);
84+
expect(callback).toHaveBeenCalledWith(cc);
8585
});
8686

8787
it("should read resource", function(){
8888
xhr.expectGET("/CreditCard/123").respond({id:123, number:'9876'});
8989
var cc = CreditCard.get({id:123}, callback);
9090
expect(cc instanceof CreditCard).toBeTruthy();
9191
nakedExpect(cc).toEqual({});
92-
expect(callback).wasNotCalled();
92+
expect(callback).not.toHaveBeenCalled();
9393
xhr.flush();
9494
nakedExpect(cc).toEqual({id:123, number:'9876'});
95-
expect(callback).wasCalledWith(cc);
95+
expect(callback).toHaveBeenCalledWith(cc);
9696
});
9797

9898
it("should read partial resource", function(){
@@ -106,7 +106,7 @@ describe("resource", function() {
106106
expect(cc.number).not.toBeDefined();
107107
cc.$get(callback);
108108
xhr.flush();
109-
expect(callback).wasCalledWith(cc);
109+
expect(callback).toHaveBeenCalledWith(cc);
110110
expect(cc.number).toEqual('9876');
111111
});
112112

@@ -115,7 +115,7 @@ describe("resource", function() {
115115

116116
var cc = CreditCard.save({id:{key:123}, name:'misko'}, callback);
117117
nakedExpect(cc).toEqual({id:{key:123}, name:'misko'});
118-
expect(callback).wasNotCalled();
118+
expect(callback).not.toHaveBeenCalled();
119119
xhr.flush();
120120
});
121121

@@ -124,10 +124,10 @@ describe("resource", function() {
124124

125125
var ccs = CreditCard.query({key:'value'}, callback);
126126
expect(ccs).toEqual([]);
127-
expect(callback).wasNotCalled();
127+
expect(callback).not.toHaveBeenCalled();
128128
xhr.flush();
129129
nakedExpect(ccs).toEqual([{id:1}, {id:2}]);
130-
expect(callback).wasCalledWith(ccs);
130+
expect(callback).toHaveBeenCalledWith(ccs);
131131
});
132132

133133
it("should have all arguments optional", function(){
@@ -143,14 +143,14 @@ describe("resource", function() {
143143
xhr.expectDELETE("/CreditCard/123").respond(200, {});
144144

145145
CreditCard.remove({id:123}, callback);
146-
expect(callback).wasNotCalled();
146+
expect(callback).not.toHaveBeenCalled();
147147
xhr.flush();
148148
nakedExpect(callback.mostRecentCall.args).toEqual([{}]);
149149

150150
callback.reset();
151151
xhr.expectDELETE("/CreditCard/333").respond(204, null);
152152
CreditCard.remove({id:333}, callback);
153-
expect(callback).wasNotCalled();
153+
expect(callback).not.toHaveBeenCalled();
154154
xhr.flush();
155155
nakedExpect(callback.mostRecentCall.args).toEqual([{}]);
156156
});
@@ -181,7 +181,7 @@ describe("resource", function() {
181181
nakedExpect(cc).toEqual({name:'misko'});
182182
xhr.flush();
183183
nakedExpect(cc).toEqual({id:123});
184-
expect(callback).wasCalledWith(cc);
184+
expect(callback).toHaveBeenCalledWith(cc);
185185
});
186186

187187
it('should not mutate the resource object if response contains no body', function(){

test/ScopeSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('scope/model', function(){
6262
var onEval = jasmine.createSpy('onEval');
6363
model.$onEval(onEval);
6464
model.$eval('');
65-
expect(onEval).wasNotCalled();
65+
expect(onEval).not.toHaveBeenCalled();
6666
});
6767

6868
it('should ignore none string/function', function(){

test/ValidatorsSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ describe('ValidatorTest', function(){
131131

132132
var spy = jasmine.createSpy();
133133
asynchronous.call(self, "kai", spy);
134-
expect(spy).wasNotCalled();
134+
expect(spy).not.toHaveBeenCalled();
135135

136136
asynchronous.call(self, "misko", spy);
137-
expect(spy).wasCalled();
137+
expect(spy).toHaveBeenCalled();
138138
});
139139

140140
it("should ignore old callbacks, and not remove spinner", function(){
@@ -156,7 +156,7 @@ describe('ValidatorTest', function(){
156156
scope.updateFn = jasmine.createSpy();
157157
scope.name = 'misko';
158158
scope.$eval();
159-
expect(scope.asyncFn).wasCalledWith('misko', scope.asyncFn.mostRecentCall.args[1]);
159+
expect(scope.asyncFn).toHaveBeenCalledWith('misko', scope.asyncFn.mostRecentCall.args[1]);
160160
assertTrue(scope.$element.hasClass('ng-input-indicator-wait'));
161161
scope.asyncFn.mostRecentCall.args[1]('myError', {id: 1234, data:'data'});
162162
assertFalse(scope.$element.hasClass('ng-input-indicator-wait'));

test/service/deferSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ describe('$defer', function() {
4343
var eval = this.spyOn(scope, '$eval').andCallThrough();
4444

4545
$defer(function() {});
46-
expect(eval).wasNotCalled();
46+
expect(eval).not.toHaveBeenCalled();
4747

4848
$browser.defer.flush();
49-
expect(eval).wasCalled();
49+
expect(eval).toHaveBeenCalled();
5050

5151
eval.reset(); //reset the spy;
5252

@@ -61,10 +61,10 @@ describe('$defer', function() {
6161
var eval = this.spyOn(scope, '$eval').andCallThrough();
6262

6363
$defer(function() {throw "Test Error";});
64-
expect(eval).wasNotCalled();
64+
expect(eval).not.toHaveBeenCalled();
6565

6666
$browser.defer.flush();
67-
expect(eval).wasCalled();
67+
expect(eval).toHaveBeenCalled();
6868
});
6969

7070
it('should allow you to specify the delay time', function(){

test/service/xhr.bulkSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ describe('$xhr.bulk', function() {
5757
$xhrBulk.flush(function(){ log += 'DONE';});
5858
$browserXhr.flush();
5959

60-
expect($xhrError).wasCalled();
60+
expect($xhrError).toHaveBeenCalled();
6161
var cb = $xhrError.mostRecentCall.args[0].callback;
6262
expect(typeof cb).toEqual($function);
63-
expect($xhrError).wasCalledWith(
63+
expect($xhrError).toHaveBeenCalledWith(
6464
{url:'/req1', method:'GET', data:null, callback:cb},
6565
{status:404, response:'NotFound'});
6666

test/service/xhr.cacheSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@ describe('$xhr.cache', function() {
128128

129129
$browserXhr.expectGET('/url').respond('+');
130130
cache('GET', '/url', null, callback);
131-
expect(eval).wasNotCalled();
131+
expect(eval).not.toHaveBeenCalled();
132132

133133
$browserXhr.flush();
134-
expect(eval).wasCalled();
134+
expect(eval).toHaveBeenCalled();
135135

136136
eval.reset(); //reset the spy
137137

138138
cache('GET', '/url', null, callback);
139-
expect(eval).wasNotCalled();
139+
expect(eval).not.toHaveBeenCalled();
140140

141141
$browser.defer.flush();
142-
expect(eval).wasCalled();
142+
expect(eval).toHaveBeenCalled();
143143
});
144144
});

test/service/xhr.errorSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('$xhr.error', function() {
2929
$browserXhr.flush();
3030
var cb = $xhrError.mostRecentCall.args[0].callback;
3131
expect(typeof cb).toEqual($function);
32-
expect($xhrError).wasCalledWith(
32+
expect($xhrError).toHaveBeenCalledWith(
3333
{url:'/req', method:'POST', data:'MyData', callback:cb},
3434
{status:500, body:'MyError'});
3535
});

test/service/xhrSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('$xhr', function() {
6060
$xhr('GET', '/reqGET', null, function(){ throw "MyException"; });
6161
$browserXhr.flush();
6262

63-
expect($log.error).wasCalledWith("MyException");
63+
expect($log.error).toHaveBeenCalledWith("MyException");
6464
});
6565

6666

0 commit comments

Comments
 (0)