File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,3 +160,36 @@ describe('computeTowers edge cases', () => {
160160 expect ( towers [ 0 ] . h ) . toBe ( 24 ) ;
161161 } ) ;
162162} ) ;
163+
164+ it ( 'assigns correct row and col values based on week/day position' , ( ) => {
165+ const calendar = {
166+ totalContributions : 0 ,
167+ weeks : [
168+ {
169+ contributionDays : [
170+ { contributionCount : 1 , date : '2024-06-10' } ,
171+ { contributionCount : 1 , date : '2024-06-11' } ,
172+ { contributionCount : 1 , date : '2024-06-12' } ,
173+ ] ,
174+ } ,
175+ {
176+ contributionDays : [
177+ { contributionCount : 1 , date : '2024-06-13' } ,
178+ { contributionCount : 1 , date : '2024-06-14' } ,
179+ { contributionCount : 1 , date : '2024-06-15' } ,
180+ ] ,
181+ } ,
182+ ] ,
183+ } as unknown as ContributionCalendar ;
184+
185+ const towers = computeTowers ( calendar , 'linear' , '2024-06-15' ) ;
186+
187+ expect ( towers [ 0 ] . row ) . toBe ( 0 ) ;
188+ expect ( towers [ 0 ] . col ) . toBe ( 0 ) ;
189+
190+ expect ( towers [ 1 ] . row ) . toBe ( 0 ) ;
191+ expect ( towers [ 1 ] . col ) . toBe ( 1 ) ;
192+
193+ expect ( towers [ 3 ] . row ) . toBe ( 1 ) ;
194+ expect ( towers [ 3 ] . col ) . toBe ( 0 ) ;
195+ } ) ;
You can’t perform that action at this time.
0 commit comments