mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Boarding status update issue fix
This commit is contained in:
@@ -228,6 +228,24 @@ describe("Ticketing — generate / scanAndBoard / validate / smart-reassign", ()
|
||||
|
||||
const ticket = await harness.prisma.ticket.findFirst({ where: { bookingId: booking.id } });
|
||||
expect(ticket?.validatedAt).toBeTruthy();
|
||||
expect(ticket?.status).toBe('USED');
|
||||
});
|
||||
|
||||
it("does not allow boarding the same ticket twice", async () => {
|
||||
const { schedule, seats } = await createTestSchedule({ trainNumber: `TIX-BOARD-REUSE-${Date.now()}`, departureAt: future(60), arrivalAt: future(120) });
|
||||
const booking = await createOneWayBooking(schedule.id, seats[0].id);
|
||||
await markSucceeded(booking.id);
|
||||
await ticketsService.generate(booking.id);
|
||||
|
||||
const first = await ticketsService.scanAndBoard(booking.bookingRef, "gate-validator-1");
|
||||
expect(first.success).toBe(true);
|
||||
|
||||
const second = await ticketsService.scanAndBoard(booking.bookingRef, "gate-validator-1");
|
||||
expect(second.success).toBe(false);
|
||||
expect(second.error).toMatch(/already used/i);
|
||||
|
||||
const ticket = await harness.prisma.ticket.findFirst({ where: { bookingId: booking.id } });
|
||||
expect(ticket?.status).toBe('USED');
|
||||
});
|
||||
|
||||
it("refuses boarding before the boarding window opens", async () => {
|
||||
|
||||
Reference in New Issue
Block a user