Просмотр исходного кода

Update test with new date util names

arvid-e 5 месяцев назад
Родитель
Сommit
f7f6421131

+ 5 - 5
apps/app/src/features/contribution-graph/utils/contribution-graph-utils.spec.ts

@@ -1,6 +1,6 @@
 import {
 import {
-  daysSinceLastUpdate,
   getCurrentWeekStart,
   getCurrentWeekStart,
+  getDaysDifference,
   getISOWeekId,
   getISOWeekId,
 } from './contribution-graph-utils';
 } from './contribution-graph-utils';
 
 
@@ -34,14 +34,14 @@ describe('Date Utility Functions (date-fns refactor)', () => {
   describe('daysSinceLastUpdate', () => {
   describe('daysSinceLastUpdate', () => {
     test('should return 0 when lastUpdateDate equals currentDate', () => {
     test('should return 0 when lastUpdateDate equals currentDate', () => {
       const date = new Date('2025-10-01T12:00:00Z');
       const date = new Date('2025-10-01T12:00:00Z');
-      expect(daysSinceLastUpdate(date, date)).toBe(0);
+      expect(getDaysDifference(date, date)).toBe(0);
     });
     });
 
 
     test('should return 3 if lastUpdateDate is 3 days in the future', () => {
     test('should return 3 if lastUpdateDate is 3 days in the future', () => {
       const currentDate = new Date('2025-10-01T12:00:00Z');
       const currentDate = new Date('2025-10-01T12:00:00Z');
       const lastUpdateDate = new Date('2025-10-04T12:00:00Z');
       const lastUpdateDate = new Date('2025-10-04T12:00:00Z');
       // differenceInDays(lastUpdateDate, currentDate) -> 3
       // differenceInDays(lastUpdateDate, currentDate) -> 3
-      expect(daysSinceLastUpdate(lastUpdateDate, currentDate)).toBe(3);
+      expect(getDaysDifference(lastUpdateDate, currentDate)).toBe(3);
     });
     });
 
 
     test('should return 0 if lastUpdateDate is 3 days in the past (i.e., the update already occurred)', () => {
     test('should return 0 if lastUpdateDate is 3 days in the past (i.e., the update already occurred)', () => {
@@ -49,14 +49,14 @@ describe('Date Utility Functions (date-fns refactor)', () => {
       const lastUpdateDate = new Date('2025-10-01T12:00:00Z');
       const lastUpdateDate = new Date('2025-10-01T12:00:00Z');
       // differenceInDays(lastUpdateDate, currentDate) -> -3
       // differenceInDays(lastUpdateDate, currentDate) -> -3
       // Math.max(0, -3) -> 0
       // Math.max(0, -3) -> 0
-      expect(daysSinceLastUpdate(lastUpdateDate, currentDate)).toBe(0);
+      expect(getDaysDifference(lastUpdateDate, currentDate)).toBe(0);
     });
     });
 
 
     test('should return 0 regardless of time if lastUpdateDate is in the past', () => {
     test('should return 0 regardless of time if lastUpdateDate is in the past', () => {
       const currentDate = new Date('2025-10-02T01:00:00Z');
       const currentDate = new Date('2025-10-02T01:00:00Z');
       const lastUpdateDate = new Date('2025-10-01T23:00:00Z');
       const lastUpdateDate = new Date('2025-10-01T23:00:00Z');
       // differenceInDays ignores time, so lastUpdateDate (Oct 1) is before currentDate (Oct 2), resulting in -1
       // differenceInDays ignores time, so lastUpdateDate (Oct 1) is before currentDate (Oct 2), resulting in -1
-      expect(daysSinceLastUpdate(lastUpdateDate, currentDate)).toBe(0);
+      expect(getDaysDifference(lastUpdateDate, currentDate)).toBe(0);
     });
     });
   });
   });