@@ -37,34 +37,52 @@ describe('createGroupAssignment', () => {
3737
3838describe ( 'isStaffAssignment' , ( ) => {
3939 it ( 'returns true for staff assignments' , ( ) => {
40- expect ( isStaffAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 } ) ) . toBe ( true ) ;
41- expect ( isStaffAssignment ( { assignmentCode : 'staff-scrambler' , activityId : 1 } ) ) . toBe ( true ) ;
42- expect ( isStaffAssignment ( { assignmentCode : 'staff-runner' , activityId : 1 } ) ) . toBe ( true ) ;
40+ expect (
41+ isStaffAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 , stationNumber : null } )
42+ ) . toBe ( true ) ;
43+ expect (
44+ isStaffAssignment ( { assignmentCode : 'staff-scrambler' , activityId : 1 , stationNumber : null } )
45+ ) . toBe ( true ) ;
46+ expect (
47+ isStaffAssignment ( { assignmentCode : 'staff-runner' , activityId : 1 , stationNumber : null } )
48+ ) . toBe ( true ) ;
4349 } ) ;
4450
4551 it ( 'returns false for non-staff assignments' , ( ) => {
46- expect ( isStaffAssignment ( { assignmentCode : 'competitor' , activityId : 1 } ) ) . toBe ( false ) ;
52+ expect (
53+ isStaffAssignment ( { assignmentCode : 'competitor' , activityId : 1 , stationNumber : null } )
54+ ) . toBe ( false ) ;
4755 } ) ;
4856} ) ;
4957
5058describe ( 'isCompetitorAssignment' , ( ) => {
51- it ( 'returns true for competitor assignment' , ( ) => {
52- expect ( isCompetitorAssignment ( { assignmentCode : 'competitor' , activityId : 1 } ) ) . toBe ( true ) ;
59+ it ( 'returns true for competitor assignments' , ( ) => {
60+ expect (
61+ isCompetitorAssignment ( { assignmentCode : 'competitor' , activityId : 1 , stationNumber : null } )
62+ ) . toBe ( true ) ;
5363 } ) ;
5464
55- it ( 'returns false for staff assignments' , ( ) => {
56- expect ( isCompetitorAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 } ) ) . toBe ( false ) ;
65+ it ( 'returns false for non-competitor assignments' , ( ) => {
66+ expect (
67+ isCompetitorAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 , stationNumber : null } )
68+ ) . toBe ( false ) ;
5769 } ) ;
5870} ) ;
5971
6072describe ( 'isJudgeAssignment' , ( ) => {
61- it ( 'returns true for judge assignment' , ( ) => {
62- expect ( isJudgeAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 } ) ) . toBe ( true ) ;
73+ it ( 'returns true for judge assignments' , ( ) => {
74+ expect (
75+ isJudgeAssignment ( { assignmentCode : 'staff-judge' , activityId : 1 , stationNumber : null } )
76+ ) . toBe ( true ) ;
6377 } ) ;
6478
65- it ( 'returns false for other assignments' , ( ) => {
66- expect ( isJudgeAssignment ( { assignmentCode : 'staff-scrambler' , activityId : 1 } ) ) . toBe ( false ) ;
67- expect ( isJudgeAssignment ( { assignmentCode : 'competitor' , activityId : 1 } ) ) . toBe ( false ) ;
79+ it ( 'returns false for non-judge assignments' , ( ) => {
80+ expect (
81+ isJudgeAssignment ( { assignmentCode : 'staff-scrambler' , activityId : 1 , stationNumber : null } )
82+ ) . toBe ( false ) ;
83+ expect (
84+ isJudgeAssignment ( { assignmentCode : 'competitor' , activityId : 1 , stationNumber : null } )
85+ ) . toBe ( false ) ;
6886 } ) ;
6987} ) ;
7088
@@ -79,13 +97,14 @@ describe('hasAssignment', () => {
7997 birthdate : '2000-01-01' ,
8098 email : 'test@example.com' ,
8199 assignments : [
82- { assignmentCode : 'competitor' , activityId : 100 } ,
83- { assignmentCode : 'staff-judge' , activityId : 200 } ,
100+ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ,
101+ { assignmentCode : 'staff-judge' , activityId : 200 , stationNumber : null } ,
84102 ] ,
85103 avatar : null ,
86104 roles : [ ] ,
87105 registration : null ,
88106 personalBests : [ ] ,
107+ extensions : [ ] ,
89108 } ;
90109
91110 it ( 'checks person assignments when no filters provided' , ( ) => {
@@ -117,7 +136,7 @@ describe('hasAssignment', () => {
117136 it ( 'returns false when person has no matching assignments' , ( ) => {
118137 const personWithoutStaff : Person = {
119138 ...mockPerson ,
120- assignments : [ { assignmentCode : 'competitor' , activityId : 100 } ] ,
139+ assignments : [ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ] ,
121140 } ;
122141
123142 const hasStaff = hasAssignment ( isStaffAssignment ) ( { } ) ;
@@ -135,11 +154,12 @@ describe('doesNotHaveAssignment', () => {
135154 gender : 'm' ,
136155 birthdate : '2000-01-01' ,
137156 email : 'test@example.com' ,
138- assignments : [ { assignmentCode : 'competitor' , activityId : 100 } ] ,
157+ assignments : [ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ] ,
139158 avatar : null ,
140159 roles : [ ] ,
141160 registration : null ,
142161 personalBests : [ ] ,
162+ extensions : [ ] ,
143163 } ;
144164
145165 it ( 'returns true when person does not have assignment' , ( ) => {
@@ -164,14 +184,15 @@ describe('filterAssignments', () => {
164184 birthdate : '2000-01-01' ,
165185 email : 'test@example.com' ,
166186 assignments : [
167- { assignmentCode : 'competitor' , activityId : 100 } ,
168- { assignmentCode : 'staff-judge' , activityId : 200 } ,
169- { assignmentCode : 'staff-scrambler' , activityId : 300 } ,
187+ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ,
188+ { assignmentCode : 'staff-judge' , activityId : 200 , stationNumber : null } ,
189+ { assignmentCode : 'staff-scrambler' , activityId : 300 , stationNumber : null } ,
170190 ] ,
171191 avatar : null ,
172192 roles : [ ] ,
173193 registration : null ,
174194 personalBests : [ ] ,
195+ extensions : [ ] ,
175196 } ;
176197
177198 it ( 'filters person assignments by test' , ( ) => {
@@ -225,19 +246,20 @@ describe('helper functions', () => {
225246 birthdate : '2000-01-01' ,
226247 email : 'test@example.com' ,
227248 assignments : [
228- { assignmentCode : 'competitor' , activityId : 100 } ,
229- { assignmentCode : 'staff-judge' , activityId : 200 } ,
249+ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ,
250+ { assignmentCode : 'staff-judge' , activityId : 200 , stationNumber : null } ,
230251 ] ,
231252 avatar : null ,
232253 roles : [ ] ,
233254 registration : null ,
234255 personalBests : [ ] ,
256+ extensions : [ ] ,
235257 } ;
236258
237259 const mockPersonCompetitorOnly : Person = {
238260 ...mockPersonWithStaff ,
239261 registrantId : 2 ,
240- assignments : [ { assignmentCode : 'competitor' , activityId : 100 } ] ,
262+ assignments : [ { assignmentCode : 'competitor' , activityId : 100 , stationNumber : null } ] ,
241263 } ;
242264
243265 describe ( 'hasStaffAssignment' , ( ) => {
@@ -275,7 +297,7 @@ describe('helper functions', () => {
275297 it ( 'returns true when person lacks competitor assignment' , ( ) => {
276298 const personNoCompeting : Person = {
277299 ...mockPersonWithStaff ,
278- assignments : [ { assignmentCode : 'staff-judge' , activityId : 200 } ] ,
300+ assignments : [ { assignmentCode : 'staff-judge' , activityId : 200 , stationNumber : null } ] ,
279301 } ;
280302 expect ( missingCompetitorAssignments ( { } ) ( personNoCompeting ) ) . toBe ( true ) ;
281303 } ) ;
@@ -301,7 +323,7 @@ describe('helper functions', () => {
301323 it ( 'returns empty array when no competing assignments' , ( ) => {
302324 const personNoCompeting : Person = {
303325 ...mockPersonWithStaff ,
304- assignments : [ { assignmentCode : 'staff-judge' , activityId : 200 } ] ,
326+ assignments : [ { assignmentCode : 'staff-judge' , activityId : 200 , stationNumber : null } ] ,
305327 } ;
306328 expect ( findCompetingAssignment ( { } ) ( personNoCompeting ) ) . toEqual ( [ ] ) ;
307329 } ) ;
0 commit comments