-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The updated of `angular-mocks` up to v1.6.2 broke those unit tests, which injected a fake window object into environment. Some functions inside `angular-mocks` assume that `window.angular.callbacks` exists, and they crush otherwise. Adding such field into all fake windows injected by broken tests resolved the issue.
- Loading branch information
1 parent
8cc98f7
commit 80d9b3c
Showing
4 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,11 @@ import angular from 'angular' | |
describe('Logout Controller', function() { | ||
var controller | ||
var fakeWindow = { | ||
// Without the `angular` field our fake window will crush | ||
// `[email protected]` and higher! | ||
angular: { | ||
callbacks: {} | ||
}, | ||
location: { | ||
href: '' | ||
} | ||
|
@@ -15,14 +20,11 @@ describe('Logout Controller', function() { | |
angular.mock.module('tc.account', function($provide) { | ||
$provide.value('$window', fakeWindow) | ||
}) | ||
|
||
bard.inject(this, '$controller', 'TcAuthService', '$window', '$q', 'CONSTANTS') | ||
|
||
bard.mockService(TcAuthService, { | ||
logout: $q.when({}), | ||
_default: $q.when({}) | ||
}) | ||
|
||
controller = $controller('LogoutController') | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,11 @@ const mockData = require('../../tests/test-helpers/mock-data') | |
describe('Helper Service', function() { | ||
|
||
var fakeWindow = { | ||
// Without the `angular` field our fake window will crush | ||
// `[email protected]` and higher! | ||
angular: { | ||
callbacks: {} | ||
}, | ||
location: { | ||
href: '/' | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ describe('JWT Interceptor Service', function() { | |
}) | ||
}, | ||
fakeWindow = { | ||
// Without the `angular` field our fake window will crush | ||
// `[email protected]` and higher! | ||
angular: { | ||
callbacks: {} | ||
}, | ||
location: '' | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters