From 6fc8f76eb012449045ab11ac376dc78184f0f2c7 Mon Sep 17 00:00:00 2001 From: Eric Sizer Date: Fri, 27 Sep 2024 08:54:30 -0400 Subject: [PATCH] fix web async --- .../ApplicationCard/ApplicationCard.test.tsx | 6 ++-- .../AssessmentResultsTable.test.tsx | 2 +- .../CandidateDialog/ChangeStatusDialog.tsx | 4 +-- .../EmailVerification/EmailVerification.tsx | 4 +-- .../dialogs/DisabilityDialog.tsx | 2 +- .../dialogs/IndigenousDialog.tsx | 2 +- .../dialogs/VisibleMinorityDialog.tsx | 2 +- .../EmploymentEquity/dialogs/WomanDialog.tsx | 2 +- .../components/Pagination/Pagination.test.tsx | 2 +- .../src/components/PoolCard/PoolCard.test.tsx | 4 +-- .../QualifiedRecruitmentCard.test.tsx | 28 ++++++++-------- apps/web/src/components/Router.tsx | 4 +-- .../SearchRequestTable.test.tsx | 2 +- .../ThemeSwitcher/ThemeSwitcher.test.tsx | 6 ++-- .../SkillAccordion/SkillAccordion.test.tsx | 32 +++++++++---------- apps/web/src/hooks/usePoolMutations.ts | 4 +-- apps/web/src/lang/lang.test.ts | 2 +- .../components/AddExperienceForm.tsx | 2 +- .../components/ExperienceEditForm.tsx | 2 +- .../ApplicationCareerTimelinePage.tsx | 2 +- .../ApplicationQuestionsPage.tsx | 2 +- .../ApplicationSelfDeclarationPage.tsx | 2 +- .../SelfDeclarationForm.test.tsx | 2 +- .../ApplicationSkillsPage.tsx | 2 +- .../EmployeeInformationForm.stories.tsx | 2 ++ .../GettingStartedForm.stories.tsx | 2 ++ .../GettingStartedPage.test.tsx | 2 +- .../BrowsePoolsPage/BrowsePoolsPage.test.tsx | 4 +-- .../ActiveRecruitmentSection.test.tsx | 2 +- .../OngoingRecruitmentSection.test.tsx | 2 +- .../components/AssetSkillsSection.tsx | 6 ++-- .../components/EssentialSkillsSection.tsx | 6 ++-- .../EditPoolPage/components/SkillTable.tsx | 4 +-- .../ExperienceForm.test.tsx | 18 +++++------ .../components/ExperienceSkills.tsx | 2 ++ .../Skills/components/SkillPortfolioTable.tsx | 2 +- .../components/AddToPoolDialog.tsx | 10 ++---- .../components/NotesSection.tsx | 2 +- 38 files changed, 93 insertions(+), 93 deletions(-) diff --git a/apps/web/src/components/ApplicationCard/ApplicationCard.test.tsx b/apps/web/src/components/ApplicationCard/ApplicationCard.test.tsx index 70ce376f6cf..5be3e91b5db 100644 --- a/apps/web/src/components/ApplicationCard/ApplicationCard.test.tsx +++ b/apps/web/src/components/ApplicationCard/ApplicationCard.test.tsx @@ -56,7 +56,7 @@ describe("ApplicationCard", () => { await axeTest(container); }); - it("should have proper action links if the application is in draft", async () => { + it("should have proper action links if the application is in draft", () => { renderCard({ ...defaultProps, poolCandidateQuery: makeFragmentData( @@ -79,7 +79,7 @@ describe("ApplicationCard", () => { ); }); - it("should have proper label and action links if placed/hired in pool", async () => { + it("should have proper label and action links if placed/hired in pool", () => { renderCard({ ...defaultProps, poolCandidateQuery: makeFragmentData( @@ -122,7 +122,7 @@ describe("ApplicationCard", () => { expect(hiredCasualLabel).toBeInTheDocument(); }); - it("should have proper label if the application is draft but the pool is expired", async () => { + it("should have proper label if the application is draft but the pool is expired", () => { renderCard({ ...defaultProps, poolCandidateQuery: makeFragmentData( diff --git a/apps/web/src/components/AssessmentResultsTable/AssessmentResultsTable.test.tsx b/apps/web/src/components/AssessmentResultsTable/AssessmentResultsTable.test.tsx index ba5b28ce80c..5922b3692be 100644 --- a/apps/web/src/components/AssessmentResultsTable/AssessmentResultsTable.test.tsx +++ b/apps/web/src/components/AssessmentResultsTable/AssessmentResultsTable.test.tsx @@ -18,7 +18,7 @@ import { import { columnStatus } from "./utils"; describe("AssessmentResults", () => { - it("should compute the column status correctly", async () => { + it("should compute the column status correctly", () => { const notSureStep = applicationScreeningStep; expect( diff --git a/apps/web/src/components/CandidateDialog/ChangeStatusDialog.tsx b/apps/web/src/components/CandidateDialog/ChangeStatusDialog.tsx index 30823253c65..28d134ff193 100644 --- a/apps/web/src/components/CandidateDialog/ChangeStatusDialog.tsx +++ b/apps/web/src/components/CandidateDialog/ChangeStatusDialog.tsx @@ -233,9 +233,7 @@ const ChangeStatusDialog = ({ return Promise.reject(result.error); }; - const submitForm: SubmitHandler = async ( - formValues: FormValues, - ) => { + const submitForm: SubmitHandler = (formValues: FormValues) => { // we need to update the original pool candidate, and possibly additional ones from other pools const poolCandidatesToUpdate = [ selectedCandidate, diff --git a/apps/web/src/components/EmailVerification/EmailVerification.tsx b/apps/web/src/components/EmailVerification/EmailVerification.tsx index 0f2ec9bd566..71a486dacc6 100644 --- a/apps/web/src/components/EmailVerification/EmailVerification.tsx +++ b/apps/web/src/components/EmailVerification/EmailVerification.tsx @@ -94,7 +94,7 @@ export const EmailVerification = ({ return () => clearTimeout(timerId); }, [canRequestACode]); - const requestACode = async () => { + const requestACode = () => { executeSendEmailMutation({ emailType, }) @@ -110,7 +110,7 @@ export const EmailVerification = ({ }); }; - const submitHandler: SubmitHandler = async (data: FormValues) => { + const submitHandler: SubmitHandler = (data: FormValues) => { executeVerifyUserEmailMutation({ emailType, code: data.verificationCode, diff --git a/apps/web/src/components/EmploymentEquity/dialogs/DisabilityDialog.tsx b/apps/web/src/components/EmploymentEquity/dialogs/DisabilityDialog.tsx index 9c3ccb39da2..b3223ab7c74 100644 --- a/apps/web/src/components/EmploymentEquity/dialogs/DisabilityDialog.tsx +++ b/apps/web/src/components/EmploymentEquity/dialogs/DisabilityDialog.tsx @@ -31,7 +31,7 @@ const DisabilityDialog = ({ }); const { handleSubmit } = methods; - const submitHandler: SubmitHandler = async (data: FormValues) => { + const submitHandler: SubmitHandler = (data: FormValues) => { onSave(data.hasDisability); }; diff --git a/apps/web/src/components/EmploymentEquity/dialogs/IndigenousDialog.tsx b/apps/web/src/components/EmploymentEquity/dialogs/IndigenousDialog.tsx index cb6783e4194..93a40c802f5 100644 --- a/apps/web/src/components/EmploymentEquity/dialogs/IndigenousDialog.tsx +++ b/apps/web/src/components/EmploymentEquity/dialogs/IndigenousDialog.tsx @@ -49,7 +49,7 @@ const IndigenousDialog = ({ const communities = watch("communities"); const hasCommunitiesSelected = communities && communities.length > 0; - const submitHandler: SubmitHandler = async ( + const submitHandler: SubmitHandler = ( data: FormValuesWithSignature, ) => { const newCommunities = formValuesToApiCommunities(data); diff --git a/apps/web/src/components/EmploymentEquity/dialogs/VisibleMinorityDialog.tsx b/apps/web/src/components/EmploymentEquity/dialogs/VisibleMinorityDialog.tsx index b95bc6c6935..3725a5a76f4 100644 --- a/apps/web/src/components/EmploymentEquity/dialogs/VisibleMinorityDialog.tsx +++ b/apps/web/src/components/EmploymentEquity/dialogs/VisibleMinorityDialog.tsx @@ -31,7 +31,7 @@ const VisibleMinorityDialog = ({ }); const { handleSubmit } = methods; - const submitHandler: SubmitHandler = async (data: FormValues) => { + const submitHandler: SubmitHandler = (data: FormValues) => { onSave(data.isVisibleMinority); }; diff --git a/apps/web/src/components/EmploymentEquity/dialogs/WomanDialog.tsx b/apps/web/src/components/EmploymentEquity/dialogs/WomanDialog.tsx index fc335c82616..95bc9ea5ef0 100644 --- a/apps/web/src/components/EmploymentEquity/dialogs/WomanDialog.tsx +++ b/apps/web/src/components/EmploymentEquity/dialogs/WomanDialog.tsx @@ -31,7 +31,7 @@ const WomanDialog = ({ }); const { handleSubmit } = methods; - const submitHandler: SubmitHandler = async (data: FormValues) => { + const submitHandler: SubmitHandler = (data: FormValues) => { onSave(data.isWoman); }; diff --git a/apps/web/src/components/Pagination/Pagination.test.tsx b/apps/web/src/components/Pagination/Pagination.test.tsx index 0acaa10c1f1..096798bbc4f 100644 --- a/apps/web/src/components/Pagination/Pagination.test.tsx +++ b/apps/web/src/components/Pagination/Pagination.test.tsx @@ -56,7 +56,7 @@ const assertDotCount = (count: number) => { describe("Pagination tests", () => { const user = userEvent.setup(); - it("If the total page count is less then page chips show range from 1 to totalPageCount", async () => { + it("If the total page count is less then page chips show range from 1 to totalPageCount", () => { const props: PaginationProps = { ...defaultProps, totalCount: 50, diff --git a/apps/web/src/components/PoolCard/PoolCard.test.tsx b/apps/web/src/components/PoolCard/PoolCard.test.tsx index 9754cc0d0ea..898783b41dc 100644 --- a/apps/web/src/components/PoolCard/PoolCard.test.tsx +++ b/apps/web/src/components/PoolCard/PoolCard.test.tsx @@ -29,7 +29,7 @@ describe("PoolCard", () => { await axeTest(container); }); - it("should render the card", async () => { + it("should render the card", () => { renderPoolCard({ poolQuery: makeFragmentData(fakedPool, PoolCard_Fragment), }); @@ -52,7 +52,7 @@ describe("PoolCard", () => { ); }); - it("should render the null state correctly", async () => { + it("should render the null state correctly", () => { renderPoolCard({ poolQuery: makeFragmentData(nullPool, PoolCard_Fragment), }); diff --git a/apps/web/src/components/QualifiedRecruitmentCard/QualifiedRecruitmentCard.test.tsx b/apps/web/src/components/QualifiedRecruitmentCard/QualifiedRecruitmentCard.test.tsx index 0eb53c12ef1..e2237576257 100644 --- a/apps/web/src/components/QualifiedRecruitmentCard/QualifiedRecruitmentCard.test.tsx +++ b/apps/web/src/components/QualifiedRecruitmentCard/QualifiedRecruitmentCard.test.tsx @@ -55,7 +55,7 @@ describe("QualifiedRecruitmentCard", () => { await axeTest(container); }); - it("PLACED_CASUAL and UN-SUSPENDED", async () => { + it("PLACED_CASUAL and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -89,7 +89,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("PLACED_CASUAL and SUSPENDED", async () => { + it("PLACED_CASUAL and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -123,7 +123,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("PLACED_INDETERMINATE and UN-SUSPENDED", async () => { + it("PLACED_INDETERMINATE and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -157,7 +157,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("PLACED_INDETERMINATE and SUSPENDED", async () => { + it("PLACED_INDETERMINATE and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -191,7 +191,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("PLACED_TERM and UN-SUSPENDED", async () => { + it("PLACED_TERM and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -225,7 +225,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("PLACED_TERM and SUSPENDED", async () => { + it("PLACED_TERM and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -259,7 +259,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("QUALIFIED_AVAILABLE and UN-SUSPENDED", async () => { + it("QUALIFIED_AVAILABLE and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -284,7 +284,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(3); }); - it("QUALIFIED_AVAILABLE and SUSPENDED", async () => { + it("QUALIFIED_AVAILABLE and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -311,7 +311,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(3); }); - it("QUALIFIED_UNAVAILABLE and UN-SUSPENDED", async () => { + it("QUALIFIED_UNAVAILABLE and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -345,7 +345,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("QUALIFIED_UNAVAILABLE and SUSPENDED", async () => { + it("QUALIFIED_UNAVAILABLE and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -379,7 +379,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("QUALIFIED_WITHDREW and UN-SUSPENDED", async () => { + it("QUALIFIED_WITHDREW and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -413,7 +413,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("QUALIFIED_WITHDREW and SUSPENDED", async () => { + it("QUALIFIED_WITHDREW and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -447,7 +447,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("EXPIRED and UN-SUSPENDED", async () => { + it("EXPIRED and UN-SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( @@ -481,7 +481,7 @@ describe("QualifiedRecruitmentCard", () => { expect(buttons).toHaveLength(2); }); - it("EXPIRED and SUSPENDED", async () => { + it("EXPIRED and SUSPENDED", () => { renderCard({ ...defaultProps, candidateQuery: makeFragmentData( diff --git a/apps/web/src/components/Router.tsx b/apps/web/src/components/Router.tsx index af201e86f17..fbc8dd5e5fc 100644 --- a/apps/web/src/components/Router.tsx +++ b/apps/web/src/components/Router.tsx @@ -34,7 +34,7 @@ const createRoute = (locale: Locales) => }, { path: "dashboard", - loader: async () => { + loader: () => { throw new Response("Not Found", { status: 404 }); // unfinished page }, lazy: () => @@ -124,7 +124,7 @@ const createRoute = (locale: Locales) => }, { path: "logged-out", - loader: async () => { + loader: () => { const overridePath = sessionStorage.getItem( POST_LOGOUT_OVERRIDE_PATH_KEY, ); diff --git a/apps/web/src/components/SearchRequestTable/SearchRequestTable.test.tsx b/apps/web/src/components/SearchRequestTable/SearchRequestTable.test.tsx index 9e5260e0fd8..f4c9a7b4526 100644 --- a/apps/web/src/components/SearchRequestTable/SearchRequestTable.test.tsx +++ b/apps/web/src/components/SearchRequestTable/SearchRequestTable.test.tsx @@ -52,7 +52,7 @@ describe("SearchRequestsTable", () => { await axeTest(container); }); - it("Should render the table", async () => { + it("Should render the table", () => { renderSearchRequestsTable(); // Assert table filled with values and the result of requests[0] is present diff --git a/apps/web/src/components/ThemeSwitcher/ThemeSwitcher.test.tsx b/apps/web/src/components/ThemeSwitcher/ThemeSwitcher.test.tsx index cde16410392..00d7039a297 100644 --- a/apps/web/src/components/ThemeSwitcher/ThemeSwitcher.test.tsx +++ b/apps/web/src/components/ThemeSwitcher/ThemeSwitcher.test.tsx @@ -23,7 +23,7 @@ describe("ThemeSwitcher", () => { jest.spyOn(Object.getPrototypeOf(window.localStorage), "setItem"); Object.setPrototypeOf(window.localStorage.setItem, jest.fn()); - it("should change theme to light mode", async () => { + it("should change theme to light mode", () => { renderThemeSwitcher(); fireEvent.click( screen.getByRole("radio", { name: /activate light mode/i }), @@ -42,7 +42,7 @@ describe("ThemeSwitcher", () => { ).toHaveAttribute("data-state", "on"); }); - it("should change theme to dark mode", async () => { + it("should change theme to dark mode", () => { renderThemeSwitcher(); fireEvent.click(screen.getByRole("radio", { name: /activate dark mode/i })); @@ -59,7 +59,7 @@ describe("ThemeSwitcher", () => { ).toHaveAttribute("data-state", "on"); }); - it("should change theme to pref mode", async () => { + it("should change theme to pref mode", () => { renderThemeSwitcher(); fireEvent.click( screen.getByRole("radio", { diff --git a/apps/web/src/components/UserProfile/SkillAccordion/SkillAccordion.test.tsx b/apps/web/src/components/UserProfile/SkillAccordion/SkillAccordion.test.tsx index 618e56dc5c2..f8bdfb8a823 100644 --- a/apps/web/src/components/UserProfile/SkillAccordion/SkillAccordion.test.tsx +++ b/apps/web/src/components/UserProfile/SkillAccordion/SkillAccordion.test.tsx @@ -36,7 +36,7 @@ describe("SkillAccordion", () => { cache, ); - const openAccordion = async (name: Maybe | undefined) => { + const openAccordion = (name: Maybe | undefined) => { fireEvent.click( screen.getByRole("button", { name: new RegExp(name || "", "i"), @@ -50,7 +50,7 @@ describe("SkillAccordion", () => { await axeTest(container); }); - it("renders Skill Accordion without any issues", async () => { + it("renders Skill Accordion without any issues", () => { renderSkillAccordion(testSkill); expect( screen.getByRole("button", { @@ -59,10 +59,10 @@ describe("SkillAccordion", () => { ).toBeInTheDocument(); }); - it("renders proper context and detail when no experience provided", async () => { + it("renders proper context and detail when no experience provided", () => { renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect( screen.getByRole("region", { @@ -73,12 +73,12 @@ describe("SkillAccordion", () => { ); }); - it("renders proper context and detail when an award experience is provided", async () => { + it("renders proper context and detail when an award experience is provided", () => { const experience = experienceGenerators.awardExperiences()[0]; testSkill.experiences = [experience]; renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("1 experience")).toBeInTheDocument(); expect( @@ -88,7 +88,7 @@ describe("SkillAccordion", () => { ).toBeInTheDocument(); }); - it("renders proper context and detail when a work experience is provided", async () => { + it("renders proper context and detail when a work experience is provided", () => { const experience = experienceGenerators.workExperiences()[0]; testSkill.experiences = [experience]; const dateRange = getDateRange({ @@ -97,7 +97,7 @@ describe("SkillAccordion", () => { intl, }); renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("1 experience")).toBeInTheDocument(); @@ -119,12 +119,12 @@ describe("SkillAccordion", () => { expect(detail).toHaveTextContent(new RegExp(experience.role || "", "i")); }); - it("renders proper context and detail when a community experience is provided", async () => { + it("renders proper context and detail when a community experience is provided", () => { const experience = experienceGenerators.communityExperiences()[0]; testSkill.experiences = [experience]; renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("1 experience")).toBeInTheDocument(); @@ -140,7 +140,7 @@ describe("SkillAccordion", () => { expect(detail).toHaveTextContent(experience.title || ""); }); - it("renders proper context and detail when a education experience is provided", async () => { + it("renders proper context and detail when a education experience is provided", () => { const experience = experienceGenerators.educationExperiences()[0]; testSkill.experiences = [experience]; const dateRange = getDateRange({ @@ -150,7 +150,7 @@ describe("SkillAccordion", () => { }); renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("1 experience")).toBeInTheDocument(); @@ -166,7 +166,7 @@ describe("SkillAccordion", () => { expect(detail).toHaveTextContent(`${dateRange}`.replace(/ {3}/g, " ")); }); - it("renders proper context and detail when a personal experience is provided", async () => { + it("renders proper context and detail when a personal experience is provided", () => { const experience = experienceGenerators.personalExperiences()[0]; testSkill.experiences = [experience]; const dateRange = getDateRange({ @@ -176,7 +176,7 @@ describe("SkillAccordion", () => { }); renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("1 experience")).toBeInTheDocument(); @@ -191,14 +191,14 @@ describe("SkillAccordion", () => { expect(detail).toHaveTextContent(experience.title || ""); }); - it("renders proper context and detail when more than one experiences provided", async () => { + it("renders proper context and detail when more than one experiences provided", () => { const experience1 = experienceGenerators.workExperiences()[0]; const experience2 = experienceGenerators.educationExperiences(2)[1]; testSkill.experiences = [experience1, experience2]; renderSkillAccordion(testSkill); - await openAccordion(testSkill.name.en); + openAccordion(testSkill.name.en); expect(screen.getByText("2 experiences")).toBeInTheDocument(); diff --git a/apps/web/src/hooks/usePoolMutations.ts b/apps/web/src/hooks/usePoolMutations.ts index 7b99844acc4..9cd6ab968b4 100644 --- a/apps/web/src/hooks/usePoolMutations.ts +++ b/apps/web/src/hooks/usePoolMutations.ts @@ -258,8 +258,8 @@ const usePoolMutations = (returnPath?: string) => { ); }; - const close = (id: string, reason: string) => { - executeCloseMutation({ id, reason }) + const close = async (id: string, reason: string) => { + await executeCloseMutation({ id, reason }) .then((result) => { if (result.data?.closePool) { navigateBack(); diff --git a/apps/web/src/lang/lang.test.ts b/apps/web/src/lang/lang.test.ts index 564262185d3..f473abcde3c 100644 --- a/apps/web/src/lang/lang.test.ts +++ b/apps/web/src/lang/lang.test.ts @@ -13,7 +13,7 @@ describe("message files", () => { To update expected changes to the snapshot: `npx jest ./src/lang/lang.test.ts --testNamePattern="should have no changes to duplicate strings" --updateSnapshot` */ - it("should have no changes to duplicate strings", async () => { + it("should have no changes to duplicate strings", () => { const enMessages: Record = { ...rawWebEnMessages, ...rawI18nEnMessages, diff --git a/apps/web/src/pages/Applications/ApplicationCareerTimelineAddPage/components/AddExperienceForm.tsx b/apps/web/src/pages/Applications/ApplicationCareerTimelineAddPage/components/AddExperienceForm.tsx index d47c48a012d..2793947dc95 100644 --- a/apps/web/src/pages/Applications/ApplicationCareerTimelineAddPage/components/AddExperienceForm.tsx +++ b/apps/web/src/pages/Applications/ApplicationCareerTimelineAddPage/components/AddExperienceForm.tsx @@ -61,7 +61,7 @@ const AddExperienceForm = ({ applicationId }: AddExperienceFormProps) => { useExperienceMutations("create", type); const actionProps = register("action"); - const handleSubmit: SubmitHandler = async ( + const handleSubmit: SubmitHandler = ( formValues, ) => { const submitData = formValuesToSubmitData(formValues, [], type); diff --git a/apps/web/src/pages/Applications/ApplicationCareerTimelineEditPage/components/ExperienceEditForm.tsx b/apps/web/src/pages/Applications/ApplicationCareerTimelineEditPage/components/ExperienceEditForm.tsx index 41befa3deb6..1e36e350086 100644 --- a/apps/web/src/pages/Applications/ApplicationCareerTimelineEditPage/components/ExperienceEditForm.tsx +++ b/apps/web/src/pages/Applications/ApplicationCareerTimelineEditPage/components/ExperienceEditForm.tsx @@ -65,7 +65,7 @@ const EditExperienceForm = ({ experienceType, ); - const handleSubmit: SubmitHandler = async ( + const handleSubmit: SubmitHandler = ( formValues, ) => { const submitData = formValuesToSubmitData(formValues, [], experienceType); diff --git a/apps/web/src/pages/Applications/ApplicationCareerTimelinePage/ApplicationCareerTimelinePage.tsx b/apps/web/src/pages/Applications/ApplicationCareerTimelinePage/ApplicationCareerTimelinePage.tsx index 85bd76153a4..1e0d6d257d3 100644 --- a/apps/web/src/pages/Applications/ApplicationCareerTimelinePage/ApplicationCareerTimelinePage.tsx +++ b/apps/web/src/pages/Applications/ApplicationCareerTimelinePage/ApplicationCareerTimelinePage.tsx @@ -205,7 +205,7 @@ export const ApplicationCareerTimeline = ({ const hasSomeExperience = !!experiences.length; const hasExperiencesByType = !!experienceList.length; - const handleSubmit = async () => { + const handleSubmit = () => { executeMutation({ id: application.id, application: { diff --git a/apps/web/src/pages/Applications/ApplicationQuestionsPage/ApplicationQuestionsPage.tsx b/apps/web/src/pages/Applications/ApplicationQuestionsPage/ApplicationQuestionsPage.tsx index 480221e8e97..ade2406f610 100644 --- a/apps/web/src/pages/Applications/ApplicationQuestionsPage/ApplicationQuestionsPage.tsx +++ b/apps/web/src/pages/Applications/ApplicationQuestionsPage/ApplicationQuestionsPage.tsx @@ -66,7 +66,7 @@ const ApplicationQuestions = ({ application }: ApplicationPageProps) => { application.pool.generalQuestions?.filter(notEmpty) || []; const generalQuestionResponses = application.generalQuestionResponses?.filter(notEmpty) || []; - const handleSubmit = async (formValues: FormValues) => { + const handleSubmit = (formValues: FormValues) => { const data = formValuesToSubmitData( formValues, screeningQuestionResponses, diff --git a/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/ApplicationSelfDeclarationPage.tsx b/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/ApplicationSelfDeclarationPage.tsx index e9d02d89b0b..386200e0de0 100644 --- a/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/ApplicationSelfDeclarationPage.tsx +++ b/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/ApplicationSelfDeclarationPage.tsx @@ -371,7 +371,7 @@ export const Component = () => { const resolvedIndigenousCommunities = application.user?.indigenousCommunities?.filter(notEmpty); - const handleSubmit: SubmitHandler = async (formValues) => { + const handleSubmit: SubmitHandler = (formValues) => { // not indigenous - explore other opportunities if (formValues.action === "explore") { navigate(paths.browsePools()); diff --git a/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/SelfDeclarationForm.test.tsx b/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/SelfDeclarationForm.test.tsx index 427a2427d5b..7e7334370bd 100644 --- a/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/SelfDeclarationForm.test.tsx +++ b/apps/web/src/pages/Applications/ApplicationSelfDeclarationPage/SelfDeclarationForm.test.tsx @@ -42,7 +42,7 @@ describe("SelfDeclarationForm", () => { await axeTest(container); }); - it("should not display communities if not Indigenous", async () => { + it("should not display communities if not Indigenous", () => { renderSelfDeclarationForm(); fireEvent.click(screen.getByRole("radio", { name: /i am not a member/i })); diff --git a/apps/web/src/pages/Applications/ApplicationSkillsPage/ApplicationSkillsPage.tsx b/apps/web/src/pages/Applications/ApplicationSkillsPage/ApplicationSkillsPage.tsx index 2a9c38340b0..8397d36dd8e 100644 --- a/apps/web/src/pages/Applications/ApplicationSkillsPage/ApplicationSkillsPage.tsx +++ b/apps/web/src/pages/Applications/ApplicationSkillsPage/ApplicationSkillsPage.tsx @@ -128,7 +128,7 @@ export const ApplicationSkills = ({ "Descriptive text about how optional skills are used in the application process", }); - const handleSubmit = async () => { + const handleSubmit = () => { executeMutation({ id: application.id, application: { diff --git a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationForm.stories.tsx b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationForm.stories.tsx index 00104705017..bbff0b7469d 100644 --- a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationForm.stories.tsx +++ b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationForm.stories.tsx @@ -31,6 +31,8 @@ const Template: StoryFn = () => { { action("submit")(data); }} diff --git a/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedForm.stories.tsx b/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedForm.stories.tsx index 7be7b903a12..de8eb02b4d6 100644 --- a/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedForm.stories.tsx +++ b/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedForm.stories.tsx @@ -25,6 +25,8 @@ const Template: StoryFn = () => { { action("submit")(data); }} diff --git a/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedPage.test.tsx b/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedPage.test.tsx index 7b4aea8140b..07899d31377 100644 --- a/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedPage.test.tsx +++ b/apps/web/src/pages/Auth/RegistrationPages/GettingStartedPage/GettingStartedPage.test.tsx @@ -71,7 +71,7 @@ describe("Getting Started Form tests", () => { await axeTest(container); }); - it("should render fields", async () => { + it("should render fields", () => { renderGettingStartedForm({ query: mockFragmentData, handleSubmit: mockSave, diff --git a/apps/web/src/pages/Pools/BrowsePoolsPage/BrowsePoolsPage.test.tsx b/apps/web/src/pages/Pools/BrowsePoolsPage/BrowsePoolsPage.test.tsx index 818f8e62690..5ad1520e650 100644 --- a/apps/web/src/pages/Pools/BrowsePoolsPage/BrowsePoolsPage.test.tsx +++ b/apps/web/src/pages/Pools/BrowsePoolsPage/BrowsePoolsPage.test.tsx @@ -69,7 +69,7 @@ describe("BrowsePoolsPage", () => { await axeTest(container); }); - it("should only show published jobs", async () => { + it("should only show published jobs", () => { renderBrowsePoolsPage({ pools: [ // draft pools can not be returned by API query @@ -98,7 +98,7 @@ describe("BrowsePoolsPage", () => { ); }); - it("should only show IT and Executive jobs", async () => { + it("should only show IT and Executive jobs", () => { renderBrowsePoolsPage({ pools: [publishedItJobsPool, publishedExecJobsPool, publishedIAPJobsPool], }); diff --git a/apps/web/src/pages/Pools/BrowsePoolsPage/components/ActiveRecruitmentSection/ActiveRecruitmentSection.test.tsx b/apps/web/src/pages/Pools/BrowsePoolsPage/components/ActiveRecruitmentSection/ActiveRecruitmentSection.test.tsx index d350d165244..925aa1feb7e 100644 --- a/apps/web/src/pages/Pools/BrowsePoolsPage/components/ActiveRecruitmentSection/ActiveRecruitmentSection.test.tsx +++ b/apps/web/src/pages/Pools/BrowsePoolsPage/components/ActiveRecruitmentSection/ActiveRecruitmentSection.test.tsx @@ -38,7 +38,7 @@ describe("BrowsePoolsPage", () => { // sort logic: by expiry date whichever one expires first should appear first on the list // sort logic: if they have the same expiry date, whichever one was published first should appear first - it("should properly sort jobs", async () => { + it("should properly sort jobs", () => { // should appear first: it expires first even though it was published later const closesFirst = { ...publishedPool, diff --git a/apps/web/src/pages/Pools/BrowsePoolsPage/components/OngoingRecruitmentSection/OngoingRecruitmentSection.test.tsx b/apps/web/src/pages/Pools/BrowsePoolsPage/components/OngoingRecruitmentSection/OngoingRecruitmentSection.test.tsx index f5525acb63a..d26a5e133bb 100644 --- a/apps/web/src/pages/Pools/BrowsePoolsPage/components/OngoingRecruitmentSection/OngoingRecruitmentSection.test.tsx +++ b/apps/web/src/pages/Pools/BrowsePoolsPage/components/OngoingRecruitmentSection/OngoingRecruitmentSection.test.tsx @@ -54,7 +54,7 @@ describe("BrowsePoolsPage", () => { // sort logic: by expiry date whichever one expires first should appear first on the list // sort logic: if they have the same expiry date, whichever one was published first should appear first - it("should properly sort jobs", async () => { + it("should properly sort jobs", () => { // should appear first: it expires first even though it was published later const closesFirst = { ...publishedPool, diff --git a/apps/web/src/pages/Pools/EditPoolPage/components/AssetSkillsSection.tsx b/apps/web/src/pages/Pools/EditPoolPage/components/AssetSkillsSection.tsx index cf31b8ae1aa..20996979008 100644 --- a/apps/web/src/pages/Pools/EditPoolPage/components/AssetSkillsSection.tsx +++ b/apps/web/src/pages/Pools/EditPoolPage/components/AssetSkillsSection.tsx @@ -75,7 +75,7 @@ const AssetSkillsSection = ({ skillSelected: string, skillLevel: SkillLevel, ) => { - poolSkillMutations.create(pool.id, skillSelected, { + await poolSkillMutations.create(pool.id, skillSelected, { type: PoolSkillType.Nonessential, requiredLevel: skillLevel, }); @@ -85,13 +85,13 @@ const AssetSkillsSection = ({ poolSkillSelected: string, skillLevel: SkillLevel, ) => { - poolSkillMutations.update(poolSkillSelected, { + await poolSkillMutations.update(poolSkillSelected, { requiredLevel: skillLevel, }); }; const handleRemove = async (poolSkillSelected: string) => { - poolSkillMutations.delete(poolSkillSelected); + await poolSkillMutations.delete(poolSkillSelected); }; // disabled unless status is draft diff --git a/apps/web/src/pages/Pools/EditPoolPage/components/EssentialSkillsSection.tsx b/apps/web/src/pages/Pools/EditPoolPage/components/EssentialSkillsSection.tsx index 1de746fdc4e..df0cfe21859 100644 --- a/apps/web/src/pages/Pools/EditPoolPage/components/EssentialSkillsSection.tsx +++ b/apps/web/src/pages/Pools/EditPoolPage/components/EssentialSkillsSection.tsx @@ -75,7 +75,7 @@ const EssentialSkillsSection = ({ skillSelected: string, skillLevel: SkillLevel, ) => { - poolSkillMutations.create(pool.id, skillSelected, { + await poolSkillMutations.create(pool.id, skillSelected, { type: PoolSkillType.Essential, requiredLevel: skillLevel, }); @@ -85,13 +85,13 @@ const EssentialSkillsSection = ({ poolSkillSelected: string, skillLevel: SkillLevel, ) => { - poolSkillMutations.update(poolSkillSelected, { + await poolSkillMutations.update(poolSkillSelected, { requiredLevel: skillLevel, }); }; const handleRemove = async (poolSkillSelected: string) => { - poolSkillMutations.delete(poolSkillSelected); + await poolSkillMutations.delete(poolSkillSelected); }; // disabled unless status is draft diff --git a/apps/web/src/pages/Pools/EditPoolPage/components/SkillTable.tsx b/apps/web/src/pages/Pools/EditPoolPage/components/SkillTable.tsx index f79027dff50..647395d6933 100644 --- a/apps/web/src/pages/Pools/EditPoolPage/components/SkillTable.tsx +++ b/apps/web/src/pages/Pools/EditPoolPage/components/SkillTable.tsx @@ -72,7 +72,7 @@ const ActionCell = ( }} onSave={async (value) => { if (value.skill && value.skillLevel) { - onUpdate(poolSkillId, value.skillLevel); + await onUpdate(poolSkillId, value.skillLevel); } }} /> @@ -204,7 +204,7 @@ const SkillTable = ({ skills={availableSkills} onSave={async (value) => { if (value.skill && value.skillLevel) { - onCreate(value.skill, value.skillLevel); + await onCreate(value.skill, value.skillLevel); } }} /> diff --git a/apps/web/src/pages/Profile/ExperienceFormPage/ExperienceForm.test.tsx b/apps/web/src/pages/Profile/ExperienceFormPage/ExperienceForm.test.tsx index cce3f5c0a7b..2267978a61a 100644 --- a/apps/web/src/pages/Profile/ExperienceFormPage/ExperienceForm.test.tsx +++ b/apps/web/src/pages/Profile/ExperienceFormPage/ExperienceForm.test.tsx @@ -102,7 +102,7 @@ describe("ExperienceForm", () => { await axeTest(container); }); - it("should render award fields", async () => { + it("should render award fields", () => { renderExperienceForm({ userId: mockUserId, experienceType: "award", @@ -131,7 +131,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render community fields", async () => { + it("should render community fields", () => { renderExperienceForm({ userId: mockUserId, experienceType: "community", @@ -157,7 +157,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render education fields", async () => { + it("should render education fields", () => { renderExperienceForm({ userId: mockUserId, experienceType: "education", @@ -193,7 +193,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render personal fields", async () => { + it("should render personal fields", () => { renderExperienceForm({ userId: mockUserId, experienceType: "personal", @@ -225,7 +225,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render work fields", async () => { + it("should render work fields", () => { renderExperienceForm({ userId: mockUserId, experienceType: "work", @@ -255,7 +255,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render additional details", async () => { + it("should render additional details", () => { renderExperienceForm({ userId: mockUserId, experienceType: "work", // Type of form shouldn't matter here @@ -267,7 +267,7 @@ describe("ExperienceForm", () => { ).toBeInTheDocument(); }); - it("should render link featured skills", async () => { + it("should render link featured skills", () => { renderExperienceForm({ userId: mockUserId, experienceType: "work", // Type of form shouldn't matter here @@ -343,7 +343,7 @@ describe("ExperienceForm", () => { await waitFor(() => expect(screen.queryAllByRole("alert")).toHaveLength(0)); }); - it("should add skill", async () => { + it("should add skill", () => { renderExperienceForm({ userId: mockUserId, experienceType: "award", @@ -359,7 +359,7 @@ describe("ExperienceForm", () => { }); }); - it("delete should not render when edit is false", async () => { + it("delete should not render when edit is false", () => { renderExperienceForm({ userId: mockUserId, experienceType: "award", diff --git a/apps/web/src/pages/Profile/ExperienceFormPage/components/ExperienceSkills.tsx b/apps/web/src/pages/Profile/ExperienceFormPage/components/ExperienceSkills.tsx index 2073432ddab..2aa44935ab9 100644 --- a/apps/web/src/pages/Profile/ExperienceFormPage/components/ExperienceSkills.tsx +++ b/apps/web/src/pages/Profile/ExperienceFormPage/components/ExperienceSkills.tsx @@ -33,6 +33,8 @@ const ExperienceSkills = ({ const [accordionState, setAccordionState] = useState(""); + // Note: Needed for function colouring + // eslint-disable-next-line @typescript-eslint/require-await const handleAddSkill = async (values: SkillBrowserDialogFormValues) => { const skillId = values.skill; const skill = skills.find(({ id }) => id === skillId); diff --git a/apps/web/src/pages/Skills/components/SkillPortfolioTable.tsx b/apps/web/src/pages/Skills/components/SkillPortfolioTable.tsx index 93726e70ab6..429b42ebd83 100644 --- a/apps/web/src/pages/Skills/components/SkillPortfolioTable.tsx +++ b/apps/web/src/pages/Skills/components/SkillPortfolioTable.tsx @@ -243,7 +243,7 @@ const SkillPortfolioTable = ({ context="library" skills={unclaimedSkills} onSave={async (value) => { - executeCreateMutation({ + await executeCreateMutation({ userId: userAuthInfo?.id ?? "", skillId: value?.skill ?? "", userSkill: { diff --git a/apps/web/src/pages/Users/UserInformationPage/components/AddToPoolDialog.tsx b/apps/web/src/pages/Users/UserInformationPage/components/AddToPoolDialog.tsx index b886cc97961..22a7711e190 100644 --- a/apps/web/src/pages/Users/UserInformationPage/components/AddToPoolDialog.tsx +++ b/apps/web/src/pages/Users/UserInformationPage/components/AddToPoolDialog.tsx @@ -130,15 +130,13 @@ const AddToPoolDialog = ({ user, poolCandidates }: AddToPoolDialogProps) => { return Promise.reject(result.error); }; - const submitForm: SubmitHandler = async ( - formValues: FormValues, - ) => { + const submitForm: SubmitHandler = (formValues: FormValues) => { const poolsToUpdate = formValues.pools .map((poolId) => poolMap.get(poolId)) .filter(notEmpty); - const promises = poolsToUpdate.map((pool) => { - return requestMutation({ + const promises = poolsToUpdate.map(async (pool) => { + return await requestMutation({ pool: { connect: pool?.id, }, @@ -146,8 +144,6 @@ const AddToPoolDialog = ({ user, poolCandidates }: AddToPoolDialogProps) => { connect: id, }, expiryDate: formValues.expiryDate || emptyToNull(formValues.expiryDate), - }).catch((err) => { - throw err; }); }); diff --git a/apps/web/src/pages/Users/UserInformationPage/components/NotesSection.tsx b/apps/web/src/pages/Users/UserInformationPage/components/NotesSection.tsx index e94bb901d7f..8b7d2f503a0 100644 --- a/apps/web/src/pages/Users/UserInformationPage/components/NotesSection.tsx +++ b/apps/web/src/pages/Users/UserInformationPage/components/NotesSection.tsx @@ -35,7 +35,7 @@ const NotesSection = ({ user }: BasicUserInformationProps) => { return Promise.reject(res.error); }; - const handleSubmit = async (formValues: Record) => { + const handleSubmit = (formValues: Record) => { user?.poolCandidates?.forEach(async (candidate) => { if (candidate && (candidate.notes || "") !== formValues[candidate.id]) { await handleUpdateCandidate(