From db050b0a850e6cff18151df8a2bfd4a9e7d7f1d7 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:48:25 +0000 Subject: [PATCH] Rename files to verifySubmissionEmail --- .../VerifySubmissionEmail.stories.tsx} | 8 ++--- .../VerifySubmissionEmail.tsx} | 14 +++++---- .../helpers/downloadZip.tsx | 0 .../useQueryApplicationFileDownload.ts | 0 .../tests/VerifySubmissionEmail.test.tsx | 30 +++++++++++++++++++ .../VerifyEmail/tests/VerifyEmail.test.tsx | 28 ----------------- editor.planx.uk/src/routes/index.tsx | 4 +-- 7 files changed, 44 insertions(+), 40 deletions(-) rename editor.planx.uk/src/pages/{VerifyEmail/VerifyEmail.stories.tsx => SubmissionDownload/VerifySubmissionEmail.stories.tsx} (50%) rename editor.planx.uk/src/pages/{VerifyEmail/VerifyEmail.tsx => SubmissionDownload/VerifySubmissionEmail.tsx} (92%) rename editor.planx.uk/src/pages/{VerifyEmail => SubmissionDownload}/helpers/downloadZip.tsx (100%) rename editor.planx.uk/src/pages/{VerifyEmail => SubmissionDownload}/queries/useQueryApplicationFileDownload.ts (100%) create mode 100644 editor.planx.uk/src/pages/SubmissionDownload/tests/VerifySubmissionEmail.test.tsx delete mode 100644 editor.planx.uk/src/pages/VerifyEmail/tests/VerifyEmail.test.tsx diff --git a/editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.stories.tsx b/editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.stories.tsx similarity index 50% rename from editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.stories.tsx rename to editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.stories.tsx index f460fc667b..24c4a63099 100644 --- a/editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.stories.tsx +++ b/editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.stories.tsx @@ -1,17 +1,17 @@ import { Meta, StoryObj } from "@storybook/react"; import React from "react"; -import { VerifyEmail } from "./VerifyEmail"; +import { VerifySubmissionEmail } from "./VerifySubmissionEmail"; const meta = { title: "Design System/Pages/VerifyEmail", - component: VerifyEmail, -} satisfies Meta; + component: VerifySubmissionEmail, +} satisfies Meta; export default meta; type Story = StoryObj; export const Basic = { - render: () => , + render: () => , }; diff --git a/editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.tsx b/editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.tsx similarity index 92% rename from editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.tsx rename to editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.tsx index 0902322085..d699dd8622 100644 --- a/editor.planx.uk/src/pages/VerifyEmail/VerifyEmail.tsx +++ b/editor.planx.uk/src/pages/SubmissionDownload/VerifySubmissionEmail.tsx @@ -18,14 +18,16 @@ import useQueryApplicationFileDownload, { DOWNLOAD_APPLICATION_FILE_QUERY_KEY, } from "./queries/useQueryApplicationFileDownload"; -const verifyEmailSchema = object({ +const verifySubmissionEmailSchema = object({ email: string().email("Invalid email").required("Email address required"), }); -interface VerifyEmailProps { +interface VerifySubmissionEmailProps { params: Record; } -export const VerifyEmail = ({ params }: VerifyEmailProps): JSX.Element => { +export const VerifySubmissionEmail = ({ + params, +}: VerifySubmissionEmailProps): JSX.Element => { const { sessionId, team } = params; const [email, setEmail] = useState(""); const emailInputIsValid = useMemo(() => email !== "", [email]); @@ -81,12 +83,12 @@ export const VerifyEmail = ({ params }: VerifyEmailProps): JSX.Element => { }, validateOnChange: false, validateOnBlur: false, - validationSchema: verifyEmailSchema, + validationSchema: verifySubmissionEmailSchema, }); return ( - Download your application + Download application {isLoading ? ( @@ -96,7 +98,7 @@ export const VerifyEmail = ({ params }: VerifyEmailProps): JSX.Element => { <> diff --git a/editor.planx.uk/src/pages/VerifyEmail/helpers/downloadZip.tsx b/editor.planx.uk/src/pages/SubmissionDownload/helpers/downloadZip.tsx similarity index 100% rename from editor.planx.uk/src/pages/VerifyEmail/helpers/downloadZip.tsx rename to editor.planx.uk/src/pages/SubmissionDownload/helpers/downloadZip.tsx diff --git a/editor.planx.uk/src/pages/VerifyEmail/queries/useQueryApplicationFileDownload.ts b/editor.planx.uk/src/pages/SubmissionDownload/queries/useQueryApplicationFileDownload.ts similarity index 100% rename from editor.planx.uk/src/pages/VerifyEmail/queries/useQueryApplicationFileDownload.ts rename to editor.planx.uk/src/pages/SubmissionDownload/queries/useQueryApplicationFileDownload.ts diff --git a/editor.planx.uk/src/pages/SubmissionDownload/tests/VerifySubmissionEmail.test.tsx b/editor.planx.uk/src/pages/SubmissionDownload/tests/VerifySubmissionEmail.test.tsx new file mode 100644 index 0000000000..793713f518 --- /dev/null +++ b/editor.planx.uk/src/pages/SubmissionDownload/tests/VerifySubmissionEmail.test.tsx @@ -0,0 +1,30 @@ +import { screen } from "@testing-library/react"; +import React from "react"; +import { setup } from "testUtils"; + +import { VerifySubmissionEmail } from "../VerifySubmissionEmail"; + +describe("when the VerifySubmissionEmail component renders", () => { + it("displays the email address input", () => { + setup(); + + expect( + screen.queryByText("Verify your submission email address"), + ).toBeInTheDocument(); + expect(screen.queryByLabelText("Email address")).toBeInTheDocument(); + }); + it.todo("should not display an error message"); +}); + +describe("when the user submits a correct email address", () => { + it.todo("displays visual feedback to the user"); + it.todo("downloads the application file"); +}); + +describe("when the user submits an incorrect email address", () => { + it.todo("displays a suitable error message"); +}); + +describe("when user submits an email address and there is a server-side issue", () => { + it.todo("displays a suitable error message"); +}); diff --git a/editor.planx.uk/src/pages/VerifyEmail/tests/VerifyEmail.test.tsx b/editor.planx.uk/src/pages/VerifyEmail/tests/VerifyEmail.test.tsx deleted file mode 100644 index d2f322a8ba..0000000000 --- a/editor.planx.uk/src/pages/VerifyEmail/tests/VerifyEmail.test.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { screen } from "@testing-library/react"; -import React from "react"; -import { setup } from "testUtils"; - -import { VerifyEmail } from "../VerifyEmail"; - -describe("when the VerifyEmail component renders", () => { - it("displays the email address input", () => { - setup(); - - expect(screen.queryByText("Verify your email address")).toBeInTheDocument(); - expect(screen.queryByLabelText("Email address")).toBeInTheDocument(); - }); - it.todo("should not display an error message"); -}); - -describe("when the user submits a correct email address to the verifyEmail component", () => { - it.todo("displays visual feedback to the user"); - it.todo("downloads the application file"); -}); - -describe("when the user submits an incorrect email address to the verifyEmail component", () => { - it.todo("displays a suitable error message"); -}); - -describe("when user submits an email address to the verifyEmail component and there is a server-side issue", () => { - it.todo("displays a suitable error message"); -}); diff --git a/editor.planx.uk/src/routes/index.tsx b/editor.planx.uk/src/routes/index.tsx index 0548f7ba34..a22ec89dac 100644 --- a/editor.planx.uk/src/routes/index.tsx +++ b/editor.planx.uk/src/routes/index.tsx @@ -1,6 +1,6 @@ import { compose, lazy, map, mount, redirect, route, withView } from "navi"; import { loadingView } from "pages/layout/LoadingLayout"; -import { VerifyEmail } from "pages/VerifyEmail/VerifyEmail"; +import { VerifySubmissionEmail } from "pages/SubmissionDownload/VerifySubmissionEmail"; import * as React from "react"; import { client } from "../lib/graphql"; @@ -34,7 +34,7 @@ const editorRoutes = mount({ "/:team/:flow/:sessionId/verify-email": map((req) => { return route({ title: makeTitle("Verify your email"), - view: , + view: , }); }),