1
1
describe ( 'filters' , function ( ) {
2
+ var domain ;
2
3
3
4
beforeEach ( function ( ) {
4
5
bard . appModule ( 'topcoder' ) ;
5
6
bard . inject ( this , 'CONSTANTS' , 'roleFilter' , 'percentageFilter' , 'ordinalFilter' , 'displayLocationFilter' , 'listRolesFilter' , 'trackFilter' , 'challengeLinksFilter' ) ;
7
+ domain = CONSTANTS . domain ;
6
8
} ) ;
7
9
8
10
describe ( 'role filter' , function ( ) {
@@ -58,18 +60,17 @@ describe('filters', function() {
58
60
} ) ;
59
61
60
62
describe ( 'challengeLinksFilter' , function ( ) {
61
- // bard.inject(this, 'CONSTANTS');
62
63
it ( 'should have the correct links for DEVELOP challenge' , function ( ) {
63
64
var _ch = {
64
65
id : 1 ,
65
66
forumId : 2 ,
66
67
track : 'DEVELOP' ,
67
68
subTrack : 'CODE'
68
69
} ;
69
- expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DEVELOP' ) ;
70
- expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.topcoder-dev.com /forums/?module=Category&categoryID=2' ) ;
71
- expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DEVELOP#viewRegistrant' ) ;
72
- expect ( challengeLinksFilter ( _ch , 'submissions' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DEVELOP#viewRegistrant' ) ;
70
+ expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DEVELOP') ;
71
+ expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.' + domain + ' /forums/?module=Category&categoryID=2') ;
72
+ expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DEVELOP#viewRegistrant') ;
73
+ expect ( challengeLinksFilter ( _ch , 'submissions' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DEVELOP#viewRegistrant') ;
73
74
} ) ;
74
75
75
76
it ( 'should have the correct links for DESIGN challenge' , function ( ) {
@@ -79,10 +80,10 @@ describe('filters', function() {
79
80
track : 'DESIGN' ,
80
81
subTrack : 'WEB_DESIGN'
81
82
} ;
82
- expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DESIGN' ) ;
83
- expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.topcoder-dev.com /forums/?module=ThreadList&forumId=2' ) ;
84
- expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DESIGN#viewRegistrant' ) ;
85
- expect ( challengeLinksFilter ( _ch , 'submissions' ) ) . to . be . equal ( 'https://www.topcoder-dev.com /challenge-details/1/?type=DESIGN#viewRegistrant' ) ;
83
+ expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DESIGN') ;
84
+ expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.' + domain + ' /forums/?module=ThreadList&forumId=2') ;
85
+ expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DESIGN#viewRegistrant') ;
86
+ expect ( challengeLinksFilter ( _ch , 'submissions' ) ) . to . be . equal ( 'https://www.' + domain + ' /challenge-details/1/?type=DESIGN#viewRegistrant') ;
86
87
} ) ;
87
88
88
89
it ( 'should have the correct links for DATA_SCIENCE challenge' , function ( ) {
@@ -92,9 +93,9 @@ describe('filters', function() {
92
93
track : 'DATA_SCIENCE' ,
93
94
subTrack : 'MARATHON_MATCH'
94
95
} ;
95
- expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://community.topcoder-dev.com /tc?module=MatchDetails&rd=3' ) ;
96
- expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.topcoder-dev.com /forums/?module=ThreadList&forumID=2' ) ;
97
- expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://community.topcoder-dev.com /longcontest/?module=ViewStandings&rd=3' ) ;
96
+ expect ( challengeLinksFilter ( _ch , 'detail' ) ) . to . be . equal ( 'https://community.' + domain + ' /tc?module=MatchDetails&rd=3') ;
97
+ expect ( challengeLinksFilter ( _ch , 'forums' ) ) . to . be . equal ( 'https://apps.' + domain + ' /forums/?module=ThreadList&forumID=2') ;
98
+ expect ( challengeLinksFilter ( _ch , 'registrants' ) ) . to . be . equal ( 'https://community.' + domain + ' /longcontest/?module=ViewStandings&rd=3') ;
98
99
} ) ;
99
100
} ) ;
100
101
} ) ;
0 commit comments