From 45a9d6ab7f2189caa7eab859b4ff0fcb33e6f04c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 10 Dec 2024 09:37:23 +0000 Subject: [PATCH] Format code with Prettier --- .../screens/EventInformationScreen.test.tsx | 35 ++++----- .../screens/MembershipScreen.test.tsx | 41 +++++----- .../screens/SignUpInformationScreen.test.tsx | 78 +++++++++++++------ 3 files changed, 90 insertions(+), 64 deletions(-) diff --git a/web/__test__/screens/EventInformationScreen.test.tsx b/web/__test__/screens/EventInformationScreen.test.tsx index 913f8a9..f4f69a6 100644 --- a/web/__test__/screens/EventInformationScreen.test.tsx +++ b/web/__test__/screens/EventInformationScreen.test.tsx @@ -101,18 +101,18 @@ describe("EventInformationScreen", () => { const errorMocks = [ { request: { - query: getEventById({id: -1}), + query: getEventById({ id: -1 }), }, error: new GraphQLError("Error!"), }, ]; Object.defineProperty(window, "location", { - value: { pathname: "/events/-1" }, - }); + value: { pathname: "/events/-1" }, + }); render( - + } /> @@ -123,20 +123,19 @@ describe("EventInformationScreen", () => { ).toBeInTheDocument(); }); -// it("renders queries correctly", async () => { -// Object.defineProperty(window, "location", { -// value: { pathname: "/events/1" }, -// }); - -// render( -// -// -// } /> -// -// -// ); + // it("renders queries correctly", async () => { + // Object.defineProperty(window, "location", { + // value: { pathname: "/events/1" }, + // }); -// expect(await screen.findByText("Event 1")).toBeInTheDocument(); -// }); + // render( + // + // + // } /> + // + // + // ); + // expect(await screen.findByText("Event 1")).toBeInTheDocument(); + // }); }); diff --git a/web/__test__/screens/MembershipScreen.test.tsx b/web/__test__/screens/MembershipScreen.test.tsx index fd74cfb..037a548 100644 --- a/web/__test__/screens/MembershipScreen.test.tsx +++ b/web/__test__/screens/MembershipScreen.test.tsx @@ -43,23 +43,22 @@ vi.mock("../../api/apiRequests", () => ({ }), })); -// const mockedUseUserMembershipExpiry = vi.fn(() => +// const mockedUseUserMembershipExpiry = vi.fn(() => // { // data: {useUserMembershipExpiry: nextDate.toString()} // } // ); vi.mock("../hooks/api/useUserMembership", async () => { - const mod = - await vi.importActual( - "../../src/hooks/api/useUserMembership" - ); + const mod = await vi.importActual< + typeof import("../../src/hooks/api/useUserMembership") + >("../../src/hooks/api/useUserMembership"); return { ...mod, useUserMembershipExpiry: () => () => ({ - data: { userExpiryDate : nextDate.toString()}, - isLoading: false, - error: undefined - }), + data: { userExpiryDate: nextDate.toString() }, + isLoading: false, + error: undefined, + }), }; }); @@ -110,7 +109,7 @@ const noIntroMock = { }, result: { data: { - purchasableMemberships: { + purchasableMemberships: { data: [], }, }, @@ -164,17 +163,17 @@ describe("Membership Screen", () => { // I was unable to figure out the mock for the tanstack query hook so will do this test case later -// it("renders purchase memberships correctly", async () => { - -// render( -// -// -// -// } /> -// -// -// -// ); + // it("renders purchase memberships correctly", async () => { + + // render( + // + // + // + // } /> + // + // + // + // ); // expect( // await screen.findByText("Your current membership expires on") diff --git a/web/__test__/screens/SignUpInformationScreen.test.tsx b/web/__test__/screens/SignUpInformationScreen.test.tsx index b8bd354..8ae1d9b 100644 --- a/web/__test__/screens/SignUpInformationScreen.test.tsx +++ b/web/__test__/screens/SignUpInformationScreen.test.tsx @@ -19,10 +19,9 @@ vi.mock("react-router-dom", async () => { }); describe("AboutUsScreen", () => { - it("renders questions correctly", async () => { render( - + } /> @@ -31,16 +30,26 @@ describe("AboutUsScreen", () => { expect(await screen.findByText("Enter your name")).toBeInTheDocument(); expect(await screen.findByText("University ID number")).toBeInTheDocument(); - expect(await screen.findByText("Enter your UPI number")).toBeInTheDocument(); - expect(await screen.findByText("Enter your field of study")).toBeInTheDocument(); - expect(await screen.findByText("Enter your year of study")).toBeInTheDocument(); - expect(await screen.findByText("Enter student study status")).toBeInTheDocument(); - expect(await screen.findByText("Enter the institute you study at")).toBeInTheDocument(); + expect( + await screen.findByText("Enter your UPI number") + ).toBeInTheDocument(); + expect( + await screen.findByText("Enter your field of study") + ).toBeInTheDocument(); + expect( + await screen.findByText("Enter your year of study") + ).toBeInTheDocument(); + expect( + await screen.findByText("Enter student study status") + ).toBeInTheDocument(); + expect( + await screen.findByText("Enter the institute you study at") + ).toBeInTheDocument(); }); it("does not render errors on load up", async () => { render( - + } /> @@ -48,16 +57,22 @@ describe("AboutUsScreen", () => { ); expect(await screen.queryByText("Please enter your full name")).toBeNull(); expect(await screen.queryByText("Please enter your ID number")).toBeNull(); - expect(await screen.queryByText("Please enter your field of study")).toBeNull(); - expect(await screen.queryByText("Please select a year of study")).toBeNull(); + expect( + await screen.queryByText("Please enter your field of study") + ).toBeNull(); + expect( + await screen.queryByText("Please select a year of study") + ).toBeNull(); expect(await screen.queryByText("Please enter your UPI")).toBeNull(); - expect(await screen.queryByText("Please select a student status")).toBeNull(); + expect( + await screen.queryByText("Please select a student status") + ).toBeNull(); expect(await screen.queryByText("Please select an institute")).toBeNull(); }); it("renders error correctly", async () => { render( - + } /> @@ -65,20 +80,33 @@ describe("AboutUsScreen", () => { ); const button = await screen.findByRole("button", { - name: "Submit!", - }); - expect(button).toBeDefined(); - await fireEvent.click(button); + name: "Submit!", + }); + expect(button).toBeDefined(); + await fireEvent.click(button); - fireEvent.click(button) + fireEvent.click(button); - expect(await screen.findByText("Please enter your full name")).toBeInTheDocument(); - expect(await screen.findByText("Please enter your ID number")).toBeInTheDocument(); - expect(await screen.findByText("Please enter your field of study")).toBeInTheDocument(); - expect(await screen.findByText("Please select a year of study")).toBeInTheDocument(); - expect(await screen.findByText("Please enter your UPI")).toBeInTheDocument(); - expect(await screen.findByText("Please select a student status")).toBeInTheDocument(); - expect(await screen.findByText("Please select an institute")).toBeInTheDocument(); + expect( + await screen.findByText("Please enter your full name") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please enter your ID number") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please enter your field of study") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please select a year of study") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please enter your UPI") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please select a student status") + ).toBeInTheDocument(); + expect( + await screen.findByText("Please select an institute") + ).toBeInTheDocument(); }); - });