Skip to content

Commit

Permalink
test getLastBusinessDayOfMonth
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Jan 22, 2024
1 parent 48a38dc commit e3dfa06
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/unit/DateUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,30 @@ describe('DateUtils', () => {
});
});
});

describe('getLastBusinessDayOfMonth', () => {
const scenarios = [
{
// Last business of May in 2025
inputDate: new Date(2025, 4),
expectedResult: 30,
},
{
// Last business of January in 2024
inputDate: new Date(2024, 0),
expectedResult: 31,
},
{
// Last business of September in 2023
inputDate: new Date(2023, 8),
expectedResult: 29,
},
];

test.each(scenarios)('returns a last business day of an input date', ({inputDate, expectedResult}) => {
const lastBusinessDay = DateUtils.getLastBusinessDayOfMonth(inputDate);

expect(lastBusinessDay).toEqual(expectedResult);
});
});
});

0 comments on commit e3dfa06

Please sign in to comment.