diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 173e206437..b9be3cff16 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -1,6 +1,5 @@ import DataObjectIcon from "@mui/icons-material/DataObject"; import Box from "@mui/material/Box"; -import FormControlLabel from "@mui/material/FormControlLabel"; import Link from "@mui/material/Link"; import Typography from "@mui/material/Typography"; import { @@ -352,10 +351,7 @@ const Component: React.FC = (props: Props) => { - setFieldValue( - "allowInviteToPay", - !values.allowInviteToPay, - ) + setFieldValue("allowInviteToPay", !values.allowInviteToPay) } label="Allow applicants to invite someone else to pay" /> diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx index b58c3774c1..674c69398a 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx @@ -450,3 +450,31 @@ describe("Confirm component in information-only mode", () => { expect(results).toHaveNoViolations(); }); }); + +describe("the demo user view", () => { + beforeEach(() => { + act(() => + setState({ + teamSlug: "demo", + }), + ); + }); + it.only("should render an error when teamSlug is demo", async () => { + const handleSubmit = vi.fn(); + const { queryByText } = setup( + , + ); + const errorHeader = queryByText("GOV.UK Pay is not enabled for demo users"); + const errorGuidance = queryByText( + "Click continue to skip payment and proceed with your application for testing.", + ); + + expect(errorGuidance).toBeInTheDocument(); + expect(errorHeader).toBeInTheDocument(); + }); +}); diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index 342b6d2ac4..f372ebcc0b 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -78,7 +78,7 @@ function Component(props: Props) { const errorMessage = teamSlug !== "demo" ? "GOV.UK Pay is not enabled for this local authority" - : "GOV.UK Pay is not enabled demo users"; + : "GOV.UK Pay is not enabled for demo users"; // Handles UI states const reducer = (_state: ComponentState, action: Action): ComponentState => { @@ -302,7 +302,10 @@ function Component(props: Props) { : "Retry payment" } error={ - (state.status === "unsupported_team" && errorMessage) || + (teamSlug === "demo" && + "GOV.UK Pay is not enabled for demo users") || + (state.status === "unsupported_team" && + "GOV.UK Pay is not enabled for this local authority") || (state.status === "undefined_fee" && "We are unable to calculate your fee right now") || undefined