mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-23 04:19:48 +00:00
Update test case, fix comments
This commit is contained in:
@@ -11,8 +11,18 @@ describe('formatCurrency', () => {
|
||||
|
||||
describe('getDayDiff', () => {
|
||||
test('Should calculate correctly', () => {
|
||||
const result = getDayDiff(new Date('2023/11/30'), new Date('2023/12/01'));
|
||||
const case_1 = getDayDiff(new Date('2023/11/30'), new Date('2023/12/01'));
|
||||
const case_2 = getDayDiff(new Date('2023/12/15'), new Date('2023/12/20'));
|
||||
const case_3 = getDayDiff(new Date('2023/12/31'), new Date('2024/01/01'));
|
||||
|
||||
expect(result).toEqual(1);
|
||||
expect(case_1).toEqual(1);
|
||||
expect(case_2).toEqual(5);
|
||||
expect(case_3).toEqual(1);
|
||||
});
|
||||
|
||||
test('Should return 0 if startDate larger than endDate', () => {
|
||||
const result = getDayDiff(new Date('2023/11/30'), new Date('2023/11/20'));
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user