Files
edr-platform/e2e-ui/specs/portal/ua11-expired-promo-round-trip.spec.ts
2026-07-28 16:12:44 +03:00

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
});