mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
27 lines
992 B
TypeScript
27 lines
992 B
TypeScript
import { test, expect } from "@playwright/test";
|
|
import { PrismaClient } from "@prisma/client";
|
|
import { bookTrip } from "../../fixtures/booking-flow";
|
|
import { PROMO_EXPIRED } from "../../fixtures/data";
|
|
|
|
const prisma = new PrismaClient();
|
|
test.afterAll(async () => {
|
|
await prisma.$disconnect();
|
|
});
|
|
|
|
/**
|
|
* Round-trip variant of UA-11: an EXPIRED promo must not discount either leg of a round trip.
|
|
* Booked total should be the full two-leg fare (UA-6 baseline: cardBaseFareMinor * 2).
|
|
*/
|
|
test("round-trip: an expired promo code is ignored — full two-leg fare is booked", async ({ page }) => {
|
|
const r = await bookTrip(page, {
|
|
tripType: "ROUND_TRIP",
|
|
paymentMethod: "WALLET",
|
|
promoCode: PROMO_EXPIRED,
|
|
});
|
|
expect(r.confirmed).toBe(true);
|
|
|
|
const booking = await prisma.booking.findUniqueOrThrow({ where: { id: r.bookingId } });
|
|
expect(booking.bookingType).toBe("ROUND_TRIP");
|
|
expect(booking.totalMinor).toBe(r.cardBaseFareMinor * 2); // no discount applied
|
|
});
|