Correcting tests regarding court prioritization

This commit is contained in:
Collin Duncan 2025-04-02 14:21:05 +02:00
parent f0d4207880
commit 82ff838359
No known key found for this signature in database

View file

@ -21,6 +21,7 @@ describe('baanreserveren.service', () => {
beforeAll(async () => { beforeAll(async () => {
pageGotoSpy = jest pageGotoSpy = jest
.fn() .fn()
.mockClear()
.mockImplementation(() => Promise.resolve({ status: () => 200 })) .mockImplementation(() => Promise.resolve({ status: () => 200 }))
module = await Test.createTestingModule({ module = await Test.createTestingModule({
providers: [ providers: [
@ -54,10 +55,12 @@ describe('baanreserveren.service', () => {
brService = module.get<BaanReserverenService>(BaanReserverenService) brService = module.get<BaanReserverenService>(BaanReserverenService)
}) })
beforeEach(() => pageGotoSpy.mockClear())
describe('performSpeedyReservation', () => { describe('performSpeedyReservation', () => {
it.each([ it.each([
[18, 15, CourtSlot.Seven, CourtSlot.Six], [18, 15, CourtSlot.Six, CourtSlot.Seven],
[18, 30, CourtSlot.Four, CourtSlot.Two], [18, 30, CourtSlot.One, CourtSlot.Four],
[18, 45, CourtSlot.Twelve, CourtSlot.Thirteen], [18, 45, CourtSlot.Twelve, CourtSlot.Thirteen],
])( ])(
'should try highest ranked court first', 'should try highest ranked court first',
@ -89,8 +92,8 @@ describe('baanreserveren.service', () => {
) )
it.each([ it.each([
[18, 15, CourtSlot.Seven, CourtSlot.Eight], [18, 15, CourtSlot.Six, CourtSlot.Seven],
[18, 30, CourtSlot.Four, CourtSlot.Two], [18, 30, CourtSlot.One, CourtSlot.Four],
[18, 45, CourtSlot.Twelve, CourtSlot.Thirteen], [18, 45, CourtSlot.Twelve, CourtSlot.Thirteen],
])( ])(
'should try backup if first rank is taken', 'should try backup if first rank is taken',