Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify email component #4019

Open
wants to merge 14 commits into
base: jh/verify-email-page
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"jest-environment-jsdom": "^29.7.0",
"jest-localstorage-mock": "^2.4.26",
"lint-staged": "^13.2.3",
"msw": "^2.7.0",
"postcss": "^8.4.32",
"prettier": "^3.0.0",
"react-refresh": "^0.14.0",
Expand Down
175 changes: 173 additions & 2 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { http, HttpResponse } from "msw";
import { DOWNLOAD_APPLICATION_FILE_URL } from "pages/SubmissionDownload/VerifySubmissionEmail";

export const mockData = new ArrayBuffer(100); // a byte number is needed

export const getWithData = http.get(
`${DOWNLOAD_APPLICATION_FILE_URL}/a-session-id/?email=submission%40council.com&localAuthority=barking-and-dagenham`,
() => {
return new HttpResponse(mockData, { status: 200 });
},
);

export const getWithServerSideError = http.get(
`${DOWNLOAD_APPLICATION_FILE_URL}/a-session-id/?email=submission%40council.com&localAuthority=barking-and-dagenham`,
() => {
return new HttpResponse(null, { status: 500 });
},
);

export const getWith403 = http.get(
`${DOWNLOAD_APPLICATION_FILE_URL}/a-session-id/?email=wrong_email%40council.com&localAuthority=barking-and-dagenham`,
() => {
return new HttpResponse(null, { status: 403 });
},
);
5 changes: 5 additions & 0 deletions editor.planx.uk/src/mockServer/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setupServer } from "msw/node";

const server = setupServer();

export default server;
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const VerifySubmissionEmail = ({
title="Verify your submission email address"
description="We will use this to confirm that you have access to the submission email inbox that is set up for your team. Entering the correct email address will start the file download automatically."
/>

<InputRow>
<InputLabel
label={"Submission email address"}
Expand Down
Loading
Loading