Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 56a2696

Browse files
author
Parth Shah
committed
removing "only" from tests and fixing logout
1 parent 39fed36 commit 56a2696

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

app/account/logout/logout.controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
angular.module('tc.account').controller('LogoutController', LogoutController);
55

6-
LogoutController.$inject = ['$log', 'TcAuthService', '$location'];
6+
LogoutController.$inject = ['$log', 'TcAuthService', '$window', 'CONSTANTS'];
77

8-
function LogoutController($log, TcAuthService, $location) {
8+
function LogoutController($log, TcAuthService, $window, CONSTANTS) {
99
$log = $log.getInstance('LogoutController');
1010

1111
TcAuthService.logout()
1212
.then(function() {
1313
$log.debug("successfully logged out.");
1414
// redirect to home
15-
$location.path("/");
15+
$window.location.href = CONSTANTS.MAIN_URL;
1616
});
1717

1818
}

app/account/logout/logout.controller.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/* jshint -W117, -W030 */
2-
describe.only('Logout Controller', function() {
2+
describe('Logout Controller', function() {
33
var controller;
4-
var fakeLocation = {
5-
path: function(param) {
6-
return;
4+
var fakeWindow = {
5+
location: {
6+
href: ''
77
}
88
};
9-
sinon.spy(fakeLocation, "path");
9+
1010

1111
beforeEach(function() {
1212
bard.appModule('topcoder');
1313
bard.appModule('tc.account');
1414
module('tc.account', function($provide) {
15-
$provide.value('$location', fakeLocation);
15+
$provide.value('$window', fakeWindow);
1616
});
1717

18-
bard.inject(this, '$controller', 'TcAuthService', '$location', '$q');
18+
bard.inject(this, '$controller', 'TcAuthService', '$window', '$q', 'CONSTANTS');
1919

2020
bard.mockService(TcAuthService, {
2121
logout: $q.when({}),
@@ -33,7 +33,7 @@ describe.only('Logout Controller', function() {
3333

3434
it('should be successfully logged out', function() {
3535
expect(TcAuthService.logout).to.have.been.calledOnce;
36-
expect($location.path).to.have.been.calledWith('/');
36+
expect($window.location.href).to.equal(CONSTANTS.MAIN_URL);
3737
});
3838

3939
});

0 commit comments

Comments
 (0)