File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,6 +215,27 @@ describe('computeTowers edge cases', () => {
215215 // Assert intensityLevel is calculated correctly based on lines of code (60/60 = 100%, so intensity 4)
216216 expect ( testTower . intensityLevel ) . toBe ( 4 ) ;
217217 } ) ;
218+ it ( 'ensures all tower heights are non-negative' , ( ) => {
219+ const calendar = {
220+ totalContributions : 26 ,
221+ weeks : [
222+ {
223+ contributionDays : [
224+ { contributionCount : 0 , date : '2024-06-10' } ,
225+ { contributionCount : 1 , date : '2024-06-11' } ,
226+ { contributionCount : 5 , date : '2024-06-12' } ,
227+ { contributionCount : 20 , date : '2024-06-13' } ,
228+ ] ,
229+ } ,
230+ ] ,
231+ } as unknown as ContributionCalendar ;
232+
233+ const towers = computeTowers ( calendar , 'linear' , '2024-06-13' ) ;
234+
235+ towers . forEach ( ( tower ) => {
236+ expect ( tower . h ) . toBeGreaterThanOrEqual ( 0 ) ;
237+ } ) ;
238+ } ) ;
218239} ) ;
219240
220241it ( 'assigns correct row and col values based on week/day position' , ( ) => {
You can’t perform that action at this time.
0 commit comments