diff --git a/app/services/tcAuth.service.spec.js b/app/services/tcAuth.service.spec.js index 1df6754a7..1570ae2a8 100644 --- a/app/services/tcAuth.service.spec.js +++ b/app/services/tcAuth.service.spec.js @@ -15,91 +15,83 @@ describe('TcAuthService', function() { expect(service).to.exist; }); - describe("isAuthenticated", function() { + describe('isAuthenticated - invalid v2 token', function() { beforeEach(function() { bard.mockService(AuthTokenService, { getV2Token: function() { - return + return; }, getV3Token: function() { - return "v3Token"; + return 'v3Token'; }, + getTCSSOToken: function() { + return 'tcssoToken'; + } }); }); - it('should return false for invalid v2token', function() { + + it('should return false', function() { expect(service.isAuthenticated()).to.be.false; }); }); - describe("isAuthenticated", function() { + describe('isAuthenticated - invalid v3 token', function() { beforeEach(function() { bard.mockService(AuthTokenService, { getV2Token: function() { - return "v2Token"; + return 'v2Token'; }, getV3Token: function() { return ; }, + getTCSSOToken: function() { + return 'tcssoToken'; + } }); }); - it('should return false for invalid v3token', function() { + + it('should return false', function() { expect(service.isAuthenticated()).to.be.false; }); }); - describe("isAuthenticated", function() { + describe('isAuthenticated - invalid v2 tcsso token', function() { beforeEach(function() { bard.mockService(AuthTokenService, { getV2Token: function() { - return "v2Token"; + return 'v2Token'; }, getV3Token: function() { - return "V3Token"; + return 'v3Token'; }, + getTCSSOToken: function() { + return; + } }); }); - it('should return true for valid tokens', function() { - expect(service.isAuthenticated()).to.be.true; + + it('should return false', function() { + expect(service.isAuthenticated()).to.be.false; }); }); - describe("isAuthenticated", function() { + + describe('isAuthenticated - valid tokens', function() { beforeEach(function() { bard.mockService(AuthTokenService, { getV2Token: function() { - return ; + return 'v2Token'; }, getV3Token: function() { - return ; + return 'V3Token'; }, + getTCSSOToken: function() { + return 'tcssoToken'; + } }); }); - it('should return false for invalid tokens', function() { - expect(service.isAuthenticated()).to.be.false; + + it('should return true', function() { + expect(service.isAuthenticated()).to.be.true; }); }); }); -// describe.only('TCAuthService', function() { -// beforeEach(function() { -// var service; -// bard.appModule('tc.services'); -// bard.inject(this, '$httpBackend', 'AuthTokenService', 'TcAuthService'); -// bard.mockService(AuthTokenService, { -// getV2Token(): function() {return;}, -// getV3Token(): function() {return "v3token";} -// }); -// service = TcAuthService; -// $rootScope.$apply(); -// }); - -// // bard.verifyNoOutstandingHttpRequests(); - -// it('should exist', function() { -// expect(service).to.exist; -// }); - -// describe('isAuthenticated', function() { -// it('should return false for invalid v3 token', function() { -// expect(service.isAuthenticated()).to.be.false; -// }); -// }); -// }); diff --git a/app/specs.html b/app/specs.html index 567c25f72..3be62b5c3 100644 --- a/app/specs.html +++ b/app/specs.html @@ -74,6 +74,8 @@

Spec Runner

+ + @@ -95,6 +97,8 @@

Spec Runner

+ + @@ -106,17 +110,21 @@

Spec Runner

+ + + + @@ -155,6 +163,7 @@

Spec Runner

+ @@ -173,6 +182,8 @@

Spec Runner

+ + @@ -181,6 +192,7 @@

Spec Runner

+ @@ -188,15 +200,21 @@

Spec Runner

+ + + + + + @@ -232,15 +250,17 @@

Spec Runner

- + + +