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

Commit 72c4337

Browse files
committed
fix mocks
1 parent a313968 commit 72c4337

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/ngMock/angular-mocksSpec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ describe('ngMock', function() {
428428

429429
it('should delegate exception to the $exceptionHandler service', inject(
430430
function($interval, $exceptionHandler) {
431-
$interval(function() { throw "Test Error"; }, 1000);
431+
$interval(function() { throw new Error('Test Error'); }, 1000);
432432
expect($exceptionHandler.errors).toEqual([]);
433433

434434
$interval.flush(1000);
@@ -443,7 +443,7 @@ describe('ngMock', function() {
443443
function($interval, $rootScope) {
444444
var applySpy = spyOn($rootScope, '$apply').and.callThrough();
445445

446-
$interval(function() { throw "Test Error"; }, 1000);
446+
$interval(function() { throw new Error('Test Error'); }, 1000);
447447
expect(applySpy).not.toHaveBeenCalled();
448448

449449
$interval.flush(1000);
@@ -454,7 +454,7 @@ describe('ngMock', function() {
454454
it('should still update the interval promise when an exception is thrown',
455455
inject(function($interval) {
456456
var log = [],
457-
promise = $interval(function() { throw "Some Error"; }, 1000);
457+
promise = $interval(function() { throw new Error('Some Error'); }, 1000);
458458

459459
promise.then(function(value) { log.push('promise success: ' + value); },
460460
function(err) { log.push('promise error: ' + err); },
@@ -934,7 +934,7 @@ describe('ngMock', function() {
934934
it('should not change thrown strings', inject(function($sniffer) {
935935
expect(function() {
936936
inject(function() {
937-
throw 'test message';
937+
throw new Error('test message');
938938
});
939939
}).toThrow('test message');
940940
}));
@@ -948,7 +948,7 @@ describe('ngMock', function() {
948948
if (!error.stack) {
949949
try {
950950
throw error;
951-
} catch (e) {}
951+
} catch (e) { /** do nothing **/}
952952
}
953953

954954
return !!error.stack;
@@ -1742,23 +1742,23 @@ describe('ngMock', function() {
17421742
angular.forEach(['expectRoute', 'whenRoute'], function(routeShortcut) {
17431743
var methods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'JSONP'];
17441744
they('should provide ' + routeShortcut + ' shortcut with $prop method', methods,
1745-
function() {
1745+
/** @this **/ function() {
17461746
hb[routeShortcut](this, '/route').respond('path');
17471747
hb(this, '/route', undefined, callback);
17481748
hb.flush();
17491749
expect(callback).toHaveBeenCalledOnceWith(200, 'path', '', '');
17501750
}
17511751
);
17521752
they('should match colon deliminated parameters in ' + routeShortcut + ' $prop method', methods,
1753-
function() {
1753+
/** @this **/ function() {
17541754
hb[routeShortcut](this, '/route/:id/path/:s_id').respond('path');
17551755
hb(this, '/route/123/path/456', undefined, callback);
17561756
hb.flush();
17571757
expect(callback).toHaveBeenCalledOnceWith(200, 'path', '', '');
17581758
}
17591759
);
17601760
they('should ignore query param when matching in ' + routeShortcut + ' $prop method', methods,
1761-
function() {
1761+
/** @this **/ function() {
17621762
hb[routeShortcut](this, '/route/:id').respond('path');
17631763
hb(this, '/route/123?q=str&foo=bar', undefined, callback);
17641764
hb.flush();
@@ -2031,7 +2031,7 @@ describe('ngMock', function() {
20312031
{ name: 'flurp', id: 2 }
20322032
];
20332033
module(function($controllerProvider) {
2034-
$controllerProvider.register('testCtrl', function() {
2034+
$controllerProvider.register('testCtrl', /** @this **/ function() {
20352035
called = true;
20362036
expect(this.data).toBe(data);
20372037
});
@@ -2051,7 +2051,7 @@ describe('ngMock', function() {
20512051
{ name: 'flurp', id: 2 }
20522052
];
20532053
module(function($controllerProvider) {
2054-
$controllerProvider.register('testCtrl', function() {
2054+
$controllerProvider.register('testCtrl', /** @this **/ function() {
20552055
called = true;
20562056
expect(this.data).toBe(data);
20572057

@@ -2961,7 +2961,7 @@ describe('sharedInjector', function() {
29612961

29622962
// run a set of test cases in the sdescribe stub test framework
29632963
function ngMockTest(define) {
2964-
return function() {
2964+
return /** @this **/ function() {
29652965
var spec = this;
29662966
module.$$currentSpec(null);
29672967

0 commit comments

Comments
 (0)