@@ -21,15 +21,15 @@ describe('getCheckinDate', () => {
2121 expect ( result . getMinutes ( ) ) . toBe ( 30 ) ;
2222 } ) ;
2323
24- test ( 'returns undefined when check-in is not provided' , ( ) => {
24+ test ( 'returns epoch when check-in is not provided' , ( ) => {
2525 const result = getCheckinDate ( undefined ) ;
26- expect ( result ) . toBeUndefined ( ) ;
26+ expect ( result ) . toEqual ( new Date ( 0 ) ) ; // Date at epoch (Jan 1, 1970)
2727 } ) ;
2828
29- test ( 'returns undefined when check-in date is not available' , ( ) => {
29+ test ( 'returns epoch when check-in date is not available' , ( ) => {
3030 const checkin = { } ;
3131 const result = getCheckinDate ( checkin ) ;
32- expect ( result ) . toBeUndefined ( ) ;
32+ expect ( result ) . toEqual ( new Date ( 0 ) ) ; // Date at epoch (Jan 1, 1970)
3333 } ) ;
3434} ) ;
3535
@@ -158,7 +158,7 @@ describe('statusForPeriodByMemberScheduling', () => {
158158 const mockReportDate = new Date ( 2024 , 3 , 15 ) ; // April 15, 2024 (example report date)
159159
160160 test ( 'returns "Not Scheduled" when no check-ins are provided' , ( ) => {
161- const result = statusForPeriodByMemberScheduling ( [ ] , mockReportDate ) ;
161+ const result = statusForPeriodByMemberScheduling ( null , mockReportDate ) ;
162162 expect ( result ) . toBe ( 'Not Scheduled' ) ;
163163 } ) ;
164164
@@ -172,34 +172,11 @@ describe('statusForPeriodByMemberScheduling', () => {
172172 expect ( result ) . toBe ( 'Not Scheduled' ) ;
173173 } ) ;
174174
175- // There is a grace period of one month after the quarter in which we consider a check-in "In Progress"
176- test ( 'returns "Scheduled" when at least one check-in falls within the reporting grace period' , ( ) => {
177- const checkins = [
178- { checkInDate : [ 2024 , 2 , 1 , 10 , 30 ] , completed : false } , // Feb 1, 2024
179- { checkInDate : [ 2024 , 3 , 31 , 9 , 0 ] , completed : false } , // March 31, 2024
180- { checkInDate : [ 2024 , 7 , 10 , 14 , 0 ] , completed : false } // Jul 10, 2024
181- ] ;
182- const result = statusForPeriodByMemberScheduling ( checkins , mockReportDate ) ;
183- expect ( result ) . toBe ( 'Scheduled' ) ;
184- } ) ;
185-
186- test ( 'returns "Scheduled" when some check-ins within the reporting period are completed' , ( ) => {
187- const checkins = [
188- { checkInDate : [ 2024 , 3 , 1 , 10 , 0 ] , completed : true } , // March 1, 2024 (within reporting period, completed)
189- { checkInDate : [ 2024 , 4 , 1 , 9 , 0 ] , completed : false } , // April 1, 2024 (within reporting period, not completed)
190- { checkInDate : [ 2024 , 4 , 15 , 14 , 30 ] , completed : false } // April 15, 2024 (within reporting period, not completed)
191- ] ;
192- const result = statusForPeriodByMemberScheduling ( checkins , mockReportDate ) ;
193- expect ( result ) . toBe ( 'Scheduled' ) ;
194- } ) ;
195-
196- test ( 'returns "Scheduled" when all check-ins within the reporting period are not completed' , ( ) => {
197- const checkins = [
198- { checkInDate : [ 2024 , 3 , 1 , 10 , 0 ] , completed : false } , // March 1, 2024 (within reporting period, not completed)
199- { checkInDate : [ 2024 , 4 , 1 , 9 , 0 ] , completed : false } , // April 1, 2024 (within reporting period, not completed)
200- { checkInDate : [ 2024 , 4 , 15 , 14 , 30 ] , completed : false } // April 15, 2024 (within reporting period, not completed)
201- ] ;
202- const result = statusForPeriodByMemberScheduling ( checkins , mockReportDate ) ;
175+ test ( 'returns "Scheduled" when the check-in is within the reporting period are not completed' , ( ) => {
176+ console . log ( mockReportDate ) ;
177+ const checkin =
178+ { checkInDate : [ 2024 , 4 , 10 , 10 , 0 ] , completed : false } ; // April 1, 2024 (within reporting period, not completed)
179+ const result = statusForPeriodByMemberScheduling ( checkin , mockReportDate ) ;
203180 expect ( result ) . toBe ( 'Scheduled' ) ;
204181 } ) ;
205182} ) ;
0 commit comments