diff --git a/src/common/types/stripe.ts b/src/common/types/stripe.ts index 1ca18db7..5fb01538 100644 --- a/src/common/types/stripe.ts +++ b/src/common/types/stripe.ts @@ -28,7 +28,7 @@ export const invoiceLinkGetResponseSchema = z.array( active: z.boolean(), invoiceId: z.string().min(1), invoiceAmountUsd: z.number().min(50), - createdAt: z.union([z.string().date(), z.null()]), + createdAt: z.union([z.string().datetime(), z.null()]), }), ); diff --git a/src/ui/pages/stripe/CreateLink.tsx b/src/ui/pages/stripe/CreateLink.tsx index 8b612890..9b4110a5 100644 --- a/src/ui/pages/stripe/CreateLink.tsx +++ b/src/ui/pages/stripe/CreateLink.tsx @@ -60,7 +60,7 @@ export const StripeCreateLinkPanel: React.FC = ({ cr color: 'red', icon: , }); - throw e; + console.error(e); } }; diff --git a/src/ui/pages/stripe/CurrentLinks.tsx b/src/ui/pages/stripe/CurrentLinks.tsx index 98ce6f54..33e2c9b2 100644 --- a/src/ui/pages/stripe/CurrentLinks.tsx +++ b/src/ui/pages/stripe/CurrentLinks.tsx @@ -40,6 +40,7 @@ export const StripeCurrentLinksPanel: React.FC = ( color: 'red', icon: , }); + console.error(e); } }; getLinksOnLoad(); diff --git a/tests/e2e/stripe.spec.ts b/tests/e2e/stripe.spec.ts new file mode 100644 index 00000000..fa33b349 --- /dev/null +++ b/tests/e2e/stripe.spec.ts @@ -0,0 +1,37 @@ +import { expect } from "@playwright/test"; +import { test } from "./base"; +import { describe } from "node:test"; + +describe("Stripe Link Creation Tests", () => { + test("A user can see the link creation screen", async ({ + page, + becomeUser, + }) => { + await becomeUser(page); + await expect( + page.locator("a").filter({ hasText: "Management Portal DEV ENV" }), + ).toBeVisible(); + await expect( + page.locator("a").filter({ hasText: "Stripe Link Creator" }), + ).toBeVisible(); + await page.locator("a").filter({ hasText: "Stripe Link Creator" }).click(); + await expect( + page.getByRole("textbox", { name: "Invoice Recipient Email" }), + ).toBeVisible(); + await expect( + page.getByRole("heading", { name: "Stripe Link Creator" }), + ).toBeVisible(); + await expect( + page.getByRole("textbox", { name: "Invoice ID" }), + ).toBeVisible(); + await expect( + page.getByRole("textbox", { name: "Invoice Amount" }), + ).toBeVisible(); + await expect( + page.getByRole("textbox", { name: "Invoice Recipient Name" }), + ).toBeVisible(); + await expect( + page.getByRole("textbox", { name: "Invoice Recipient Email" }), + ).toBeVisible(); + }); +}); diff --git a/tests/unit/stripe.test.ts b/tests/unit/stripe.test.ts index ffa27f73..de4563a8 100644 --- a/tests/unit/stripe.test.ts +++ b/tests/unit/stripe.test.ts @@ -193,6 +193,7 @@ describe("Test Stripe link creation", async () => { active: true, invoiceId: "ACM102", amount: 100, + createdAt: "2025-02-09T17:11:30.762Z", }), ], }); @@ -209,6 +210,7 @@ describe("Test Stripe link creation", async () => { active: true, invoiceId: "ACM102", invoiceAmountUsd: 100, + createdAt: "2025-02-09T17:11:30.762Z", }, ]); }); @@ -226,6 +228,7 @@ describe("Test Stripe link creation", async () => { active: true, invoiceId: "ACM103", amount: 999, + createdAt: "2025-02-09T17:11:30.762Z", }), ], }); @@ -246,6 +249,7 @@ describe("Test Stripe link creation", async () => { active: true, invoiceId: "ACM103", invoiceAmountUsd: 999, + createdAt: "2025-02-09T17:11:30.762Z", }, ]); });