test: harden business boundary conditions
This commit is contained in:
@@ -60,3 +60,30 @@ it('removes the retired departmentId field from create requests', async () => {
|
||||
|
||||
expect(dto).not.toHaveProperty('departmentId');
|
||||
});
|
||||
|
||||
describe('schedule boundary validation', () => {
|
||||
it.each(['24:00', '09:60', '99:99', '9:00'])('rejects invalid time %s', async (time) => {
|
||||
const dto = createSchedule('');
|
||||
dto.startTime = time;
|
||||
expect((await validate(dto)).some((error) => error.property === 'startTime')).toBe(true);
|
||||
});
|
||||
|
||||
it.each(['2026-02-31', '2026-07-13T00:00:00Z', '2026-7-13'])(
|
||||
'rejects invalid or non-date-only value %s',
|
||||
async (date) => {
|
||||
const dto = createSchedule('');
|
||||
dto.startDate = date;
|
||||
expect((await validate(dto)).some((error) => error.property === 'startDate')).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it('accepts inclusive attendance-window limits and a leap-day date', async () => {
|
||||
const zero = createSchedule('');
|
||||
zero.attendanceAdvanceMinutes = 0;
|
||||
zero.startDate = '2028-02-29';
|
||||
const fullDay = createSchedule('');
|
||||
fullDay.attendanceAdvanceMinutes = 1440;
|
||||
expect(await validate(zero)).toEqual([]);
|
||||
expect(await validate(fullDay)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user