Compare commits
No commits in common. "63114e77368e4156ce68273b26528e11889cd430" and "d21eb747b1e1300710a3323c88558b6f509e3b11" have entirely different histories.
63114e7736
...
d21eb747b1
2 changed files with 4 additions and 14 deletions
|
|
@ -794,7 +794,7 @@ export class BaanReserverenService {
|
||||||
public getCourtSlotsForDate(date: Dayjs) {
|
public getCourtSlotsForDate(date: Dayjs) {
|
||||||
const time = date.format('HH:mm')
|
const time = date.format('HH:mm')
|
||||||
const weekdayEndSelector =
|
const weekdayEndSelector =
|
||||||
date.day() !== 0 && date.day() !== 6 ? 'weekday' : 'weekend'
|
date.day() !== 0 || date.day() !== 6 ? 'weekday' : 'weekend'
|
||||||
for (const [timeClass, timesForWeekdayAndWeekend] of Object.entries(
|
for (const [timeClass, timesForWeekdayAndWeekend] of Object.entries(
|
||||||
StartTimeClassStartTimes,
|
StartTimeClassStartTimes,
|
||||||
)) {
|
)) {
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,13 @@ describe('baanreserveren.service', () => {
|
||||||
|
|
||||||
describe('performSpeedyReservation', () => {
|
describe('performSpeedyReservation', () => {
|
||||||
it.each([
|
it.each([
|
||||||
[18, 15, CourtSlot.Seven, CourtSlot.Six],
|
[18, 15, CourtSlot.Six, CourtSlot.Seven],
|
||||||
[18, 30, CourtSlot.One, CourtSlot.Four],
|
[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',
|
||||||
async (startHour, startMinute, preferredCourt, backupCourt) => {
|
async (startHour, startMinute, preferredCourt, backupCourt) => {
|
||||||
const start = dayjs()
|
const start = dayjs()
|
||||||
.set('year', 2026)
|
|
||||||
.set('month', 7)
|
|
||||||
.set('date', 27)
|
|
||||||
.set('hour', startHour)
|
.set('hour', startHour)
|
||||||
.set('minute', startMinute)
|
.set('minute', startMinute)
|
||||||
.set('second', 0)
|
.set('second', 0)
|
||||||
|
|
@ -97,7 +94,7 @@ describe('baanreserveren.service', () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[18, 15, CourtSlot.Seven, CourtSlot.Eight],
|
[18, 15, CourtSlot.Six, CourtSlot.Seven],
|
||||||
[18, 30, CourtSlot.One, CourtSlot.Four],
|
[18, 30, CourtSlot.One, CourtSlot.Four],
|
||||||
[18, 45, CourtSlot.Twelve, CourtSlot.Thirteen],
|
[18, 45, CourtSlot.Twelve, CourtSlot.Thirteen],
|
||||||
])(
|
])(
|
||||||
|
|
@ -115,9 +112,6 @@ describe('baanreserveren.service', () => {
|
||||||
return Promise.resolve({ status: () => 200 })
|
return Promise.resolve({ status: () => 200 })
|
||||||
})
|
})
|
||||||
const start = dayjs()
|
const start = dayjs()
|
||||||
.set('year', 2026)
|
|
||||||
.set('month', 7)
|
|
||||||
.set('date', 27)
|
|
||||||
.set('hour', startHour)
|
.set('hour', startHour)
|
||||||
.set('minute', startMinute)
|
.set('minute', startMinute)
|
||||||
.set('second', 0)
|
.set('second', 0)
|
||||||
|
|
@ -144,7 +138,7 @@ describe('baanreserveren.service', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getCourtSlotsForDate', () => {
|
describe.only('getCourtSlotsForDate', () => {
|
||||||
it.each([
|
it.each([
|
||||||
{
|
{
|
||||||
date: '2025-04-10T16:30:00.000Z',
|
date: '2025-04-10T16:30:00.000Z',
|
||||||
|
|
@ -170,10 +164,6 @@ describe('baanreserveren.service', () => {
|
||||||
date: '2025-01-10T18:00:00.000Z',
|
date: '2025-01-10T18:00:00.000Z',
|
||||||
expectedCourtSlots: StartTimeClassCourtSlots[StartTimeClass.Second],
|
expectedCourtSlots: StartTimeClassCourtSlots[StartTimeClass.Second],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
date: '2026-07-26T08:30:00.000Z',
|
|
||||||
expectedCourtSlots: StartTimeClassCourtSlots[StartTimeClass.First],
|
|
||||||
},
|
|
||||||
])(
|
])(
|
||||||
'should get correct court slots for $date',
|
'should get correct court slots for $date',
|
||||||
({ date, expectedCourtSlots }) => {
|
({ date, expectedCourtSlots }) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue