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

Commit 5ce61d5

Browse files
author
vikasrohit
committed
Merge branch 'dev' into feature/quick-fixes-after-ga-release
* dev: Add test for tcsso token
2 parents 5790094 + 8fe02f4 commit 5ce61d5

File tree

2 files changed

+55
-43
lines changed

2 files changed

+55
-43
lines changed

app/services/tcAuth.service.spec.js

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,91 +15,83 @@ describe('TcAuthService', function() {
1515
expect(service).to.exist;
1616
});
1717

18-
describe("isAuthenticated", function() {
18+
describe('isAuthenticated - invalid v2 token', function() {
1919
beforeEach(function() {
2020
bard.mockService(AuthTokenService, {
2121
getV2Token: function() {
22-
return
22+
return;
2323
},
2424
getV3Token: function() {
25-
return "v3Token";
25+
return 'v3Token';
2626
},
27+
getTCSSOToken: function() {
28+
return 'tcssoToken';
29+
}
2730
});
2831
});
29-
it('should return false for invalid v2token', function() {
32+
33+
it('should return false', function() {
3034
expect(service.isAuthenticated()).to.be.false;
3135
});
3236
});
3337

34-
describe("isAuthenticated", function() {
38+
describe('isAuthenticated - invalid v3 token', function() {
3539
beforeEach(function() {
3640
bard.mockService(AuthTokenService, {
3741
getV2Token: function() {
38-
return "v2Token";
42+
return 'v2Token';
3943
},
4044
getV3Token: function() {
4145
return ;
4246
},
47+
getTCSSOToken: function() {
48+
return 'tcssoToken';
49+
}
4350
});
4451
});
45-
it('should return false for invalid v3token', function() {
52+
53+
it('should return false', function() {
4654
expect(service.isAuthenticated()).to.be.false;
4755
});
4856
});
4957

50-
describe("isAuthenticated", function() {
58+
describe('isAuthenticated - invalid v2 tcsso token', function() {
5159
beforeEach(function() {
5260
bard.mockService(AuthTokenService, {
5361
getV2Token: function() {
54-
return "v2Token";
62+
return 'v2Token';
5563
},
5664
getV3Token: function() {
57-
return "V3Token";
65+
return 'v3Token';
5866
},
67+
getTCSSOToken: function() {
68+
return;
69+
}
5970
});
6071
});
61-
it('should return true for valid tokens', function() {
62-
expect(service.isAuthenticated()).to.be.true;
72+
73+
it('should return false', function() {
74+
expect(service.isAuthenticated()).to.be.false;
6375
});
6476
});
65-
describe("isAuthenticated", function() {
77+
78+
describe('isAuthenticated - valid tokens', function() {
6679
beforeEach(function() {
6780
bard.mockService(AuthTokenService, {
6881
getV2Token: function() {
69-
return ;
82+
return 'v2Token';
7083
},
7184
getV3Token: function() {
72-
return ;
85+
return 'V3Token';
7386
},
87+
getTCSSOToken: function() {
88+
return 'tcssoToken';
89+
}
7490
});
7591
});
76-
it('should return false for invalid tokens', function() {
77-
expect(service.isAuthenticated()).to.be.false;
92+
93+
it('should return true', function() {
94+
expect(service.isAuthenticated()).to.be.true;
7895
});
7996
});
8097
});
81-
// describe.only('TCAuthService', function() {
82-
// beforeEach(function() {
83-
// var service;
84-
// bard.appModule('tc.services');
85-
// bard.inject(this, '$httpBackend', 'AuthTokenService', 'TcAuthService');
86-
// bard.mockService(AuthTokenService, {
87-
// getV2Token(): function() {return;},
88-
// getV3Token(): function() {return "v3token";}
89-
// });
90-
// service = TcAuthService;
91-
// $rootScope.$apply();
92-
// });
93-
94-
// // bard.verifyNoOutstandingHttpRequests();
95-
96-
// it('should exist', function() {
97-
// expect(service).to.exist;
98-
// });
99-
100-
// describe('isAuthenticated', function() {
101-
// it('should return false for invalid v3 token', function() {
102-
// expect(service.isAuthenticated()).to.be.false;
103-
// });
104-
// });
105-
// });

app/specs.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ <h1><a href="specs.html">Spec Runner</a></h1>
7474
<script src="../bower_components/restangular/dist/restangular.js"></script>
7575
<script src="../bower_components/angular-touch/angular-touch.js"></script>
7676
<script src="../bower_components/angular-carousel/dist/angular-carousel.js"></script>
77+
<script src="../bower_components/matchmedia/matchMedia.js"></script>
78+
<script src="../bower_components/ngSticky/lib/sticky.js"></script>
7779
<script src="../bower_components/angular-mocks/angular-mocks.js"></script>
7880
<script src="../bower_components/sinon/index.js"></script>
7981
<script src="../bower_components/bardjs/dist/bard.js"></script>
@@ -95,6 +97,8 @@ <h1><a href="specs.html">Spec Runner</a></h1>
9597
<script src="/app/skill-picker/skill-picker.module.js"></script>
9698
<script src="/app/skill-picker/skill-picker.routes.js"></script>
9799
<script src="/app/skill-picker/skill-picker.controller.js"></script>
100+
<script src="/app/sitemap/sitemap.module.js"></script>
101+
<script src="/app/sitemap/sitemap.routes.js"></script>
98102
<script src="/app/settings/settings.module.js"></script>
99103
<script src="/app/settings/settings.routes.js"></script>
100104
<script src="/app/settings/settings.controller.js"></script>
@@ -106,17 +110,21 @@ <h1><a href="specs.html">Spec Runner</a></h1>
106110
<script src="/app/services/user.service.js"></script>
107111
<script src="/app/services/tcAuth.service.js"></script>
108112
<script src="/app/services/tags.service.js"></script>
113+
<script src="/app/services/statistics.service.js"></script>
109114
<script src="/app/services/srm.service.js"></script>
110115
<script src="/app/services/scorecard.service.js"></script>
111116
<script src="/app/services/review.service.js"></script>
112117
<script src="/app/services/profile.service.js"></script>
113118
<script src="/app/services/notification.service.js"></script>
119+
<script src="/app/services/nav.service.js"></script>
114120
<script src="/app/services/memberCert.service.js"></script>
115121
<script src="/app/services/jwtInterceptor.service.js"></script>
116122
<script src="/app/services/introduction.service.js"></script>
117123
<script src="/app/services/image.service.js"></script>
118124
<script src="/app/services/helpers.service.js"></script>
119125
<script src="/app/services/externalAccounts.service.js"></script>
126+
<script src="/app/services/emptyState.service.js"></script>
127+
<script src="/app/services/communityData.service.js"></script>
120128
<script src="/app/services/challenge.service.js"></script>
121129
<script src="/app/services/blog.service.js"></script>
122130
<script src="/app/services/authtoken.service.js"></script>
@@ -155,6 +163,7 @@ <h1><a href="specs.html">Spec Runner</a></h1>
155163
<script src="/app/layout/layout.module.js"></script>
156164
<script src="/app/layout/header/header.controller.js"></script>
157165
<script src="/app/filters/underscore-strip.filter.js"></script>
166+
<script src="/app/filters/truncate.filter.js"></script>
158167
<script src="/app/filters/track.filter.js"></script>
159168
<script src="/app/filters/time-diff.filter.js"></script>
160169
<script src="/app/filters/role.filter.js"></script>
@@ -173,6 +182,8 @@ <h1><a href="specs.html">Spec Runner</a></h1>
173182
<script src="/app/directives/tcui-components.module.js"></script>
174183
<script src="/app/directives/track-toggle/track-toggle.directive.js"></script>
175184
<script src="/app/directives/tc-transclude.directive.js"></script>
185+
<script src="/app/directives/tc-tabs/tc-tabs.directive.js"></script>
186+
<script src="/app/directives/tc-sticky/tc-sticky.directive.js"></script>
176187
<script src="/app/directives/tc-section/tc-section.directive.js"></script>
177188
<script src="/app/directives/tc-paginator/tc-paginator.directive.js"></script>
178189
<script src="/app/directives/tc-endless-paginator/tc-endless-paginator.directive.js"></script>
@@ -181,22 +192,29 @@ <h1><a href="specs.html">Spec Runner</a></h1>
181192
<script src="/app/directives/skill-tile/skill-tile.directive.js"></script>
182193
<script src="/app/directives/responsive-carousel/responsive-carousel.directive.js"></script>
183194
<script src="/app/directives/profile-widget/profile-widget.directive.js"></script>
195+
<script src="/app/directives/page-state-header/page-state-header.directive.js"></script>
184196
<script src="/app/directives/on-file-change.directive.js"></script>
185197
<script src="/app/directives/ios-card/ios-card.directive.js"></script>
186198
<script src="/app/directives/input-sticky-placeholder/input-sticky-placeholder.directive.js"></script>
187199
<script src="/app/directives/history-graph/history-graph.directive.js"></script>
188200
<script src="/app/directives/header/header-menu-item.directive.js"></script>
189201
<script src="/app/directives/focus-on.directive.js"></script>
190202
<script src="/app/directives/external-account/external-account.directive.js"></script>
203+
<script src="/app/directives/empty-state-placeholder/empty-state-placeholder.directive.js"></script>
191204
<script src="/app/directives/distribution-graph/distribution-graph.directive.js"></script>
192205
<script src="/app/directives/challenge-user-place/challenge-user-place.directive.js"></script>
193206
<script src="/app/directives/challenge-tile/challenge-tile.directive.js"></script>
207+
<script src="/app/directives/challenge-links/challenge-links.directive.js"></script>
194208
<script src="/app/directives/busy-button/busy-button.directive.js"></script>
195209
<script src="/app/directives/badges/badge-tooltip.directive.js"></script>
196210
<script src="/app/directives/account/validate-register.directive.js"></script>
197211
<script src="/app/directives/account/validate-email.directive.js"></script>
198212
<script src="/app/directives/account/toggle-password-with-tips/toggle-password-with-tips.directive.js"></script>
199213
<script src="/app/directives/account/toggle-password/toggle-password.directive.js"></script>
214+
<script src="/app/community/community.module.js"></script>
215+
<script src="/app/community/statistics.controller.js"></script>
216+
<script src="/app/community/members.controller.js"></script>
217+
<script src="/app/community/community.routes.js"></script>
200218
<script src="/app/blocks/logger/logger.module.js"></script>
201219
<script src="/app/blocks/logger/logger.js"></script>
202220
<script src="/app/blocks/logger/logEnhancer.js"></script>
@@ -232,15 +250,17 @@ <h1><a href="specs.html">Spec Runner</a></h1>
232250
<script src="/app/settings/settings.spec.js"></script>
233251
<script src="/app/skill-picker/skill-picker.spec.js"></script>
234252
<script src="/app/account/login/login.spec.js"></script>
235-
<script src="/app/account/register/register.spec.js"></script>
236253
<script src="/app/account/reset-password/reset-password.spec.js"></script>
254+
<script src="/app/account/register/register.spec.js"></script>
237255
<script src="/app/blocks/exception/exception-handler.provider.spec.js"></script>
238256
<script src="/app/directives/badges/badge-tooltip.spec.js"></script>
239257
<script src="/app/directives/busy-button/busy-button.directive.spec.js"></script>
240258
<script src="/app/directives/challenge-tile/challenge-tile.spec.js"></script>
241259
<script src="/app/directives/external-account/external-account.directive.spec.js"></script>
260+
<script src="/app/directives/empty-state-placeholder/empty-state-placeholder.spec.js"></script>
242261
<script src="/app/directives/tc-endless-paginator/tc-endless-paginator.spec.js"></script>
243262
<script src="/app/directives/tc-paginator/tc-paginator.spec.js"></script>
263+
<script src="/app/directives/tc-tabs/tc-tabs.directive.spec.js"></script>
244264
<script src="/app/my-dashboard/community-updates/community-updates.spec.js"></script>
245265
<script src="/app/my-dashboard/header-dashboard/header-dashboard.spec.js"></script>
246266
<script src="/app/my-dashboard/my-challenges/my-challenges.spec.js"></script>

0 commit comments

Comments
 (0)