diff --git a/app/components/ui/Cards/EventCard.test.tsx b/app/components/ui/Cards/EventCard.test.tsx
index a149cbc6a..84e7fdd56 100644
--- a/app/components/ui/Cards/EventCard.test.tsx
+++ b/app/components/ui/Cards/EventCard.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import { EventCard } from "./EventCard";
-import { HOME_PAGE_EVENTS_DATA_FORMATTED } from "../../../../test/fixtures/EventsData";
+import { createFormattedHomePageEventsData } from "../../../../test/fixtures/EventsData";
describe("", () => {
- const eventData = HOME_PAGE_EVENTS_DATA_FORMATTED[0];
+ const eventData = createFormattedHomePageEventsData()[0];
it("displays title, link, date, and call to action", () => {
render();
diff --git a/app/components/ui/Cards/EventCardSection.test.tsx b/app/components/ui/Cards/EventCardSection.test.tsx
index 269830f64..7e306a336 100644
--- a/app/components/ui/Cards/EventCardSection.test.tsx
+++ b/app/components/ui/Cards/EventCardSection.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { render, screen } from "@testing-library/react";
-import { HOME_PAGE_EVENTS_DATA_FORMATTED } from "../../../../test/fixtures/EventsData";
+import { createFormattedHomePageEventsData } from "../../../../test/fixtures/EventsData";
import { EventCardSection } from "components/ui/Cards/EventCardSection";
describe("", () => {
- const eventData = HOME_PAGE_EVENTS_DATA_FORMATTED;
+ const eventData = createFormattedHomePageEventsData();
it("displays the correct number of event cards", () => {
render();
diff --git a/app/pages/EventDetailPage/EventDetailPage.test.tsx b/app/pages/EventDetailPage/EventDetailPage.test.tsx
index b31a0d77b..ab3bf89b1 100644
--- a/app/pages/EventDetailPage/EventDetailPage.test.tsx
+++ b/app/pages/EventDetailPage/EventDetailPage.test.tsx
@@ -3,7 +3,6 @@ import { render, screen } from "@testing-library/react";
import { EventDetailPage } from "pages/EventDetailPage/EventDetailPage";
import { EVENTS_DATA } from "../../../test/fixtures/EventsData";
import { useEventData } from "hooks/StrapiAPI";
-import { BrowserRouter } from "react-router-dom";
import { HelmetProvider } from "react-helmet-async";
let MOCK_EVENT: {
@@ -17,10 +16,6 @@ let MOCK_EVENT: {
};
jest.mock("hooks/StrapiAPI", () => ({
- // TODO: This shouldn't have to be mocked here but I'm not quite an expert
- // enough yet in jest mocking to figure out how to import the fixtures without
- // doing this.
- formatHomePageEventsData: () => null,
useEventData: () => MOCK_EVENT,
}));
diff --git a/test/fixtures/EventsData.ts b/test/fixtures/EventsData.ts
index 4bea08e43..e09dc7037 100644
--- a/test/fixtures/EventsData.ts
+++ b/test/fixtures/EventsData.ts
@@ -1,10 +1,10 @@
// Sample data from a real api request to our Strapi production server. This
// data may have to change as the api changes so developers should feel at
+// liberty to update these fixtures as needed.
import { RootNode } from "@strapi/blocks-react-renderer/dist/BlocksRenderer";
import { formatHomePageEventsData } from "hooks/StrapiAPI";
-// liberty to update these fixtures as needed.
export const EVENTS_DATA = [
{
data: {
@@ -1386,15 +1386,16 @@ export const EVENTS_DATA = [
},
];
-export const HOME_PAGE_EVENTS_DATA_FORMATTED = formatHomePageEventsData({
- data: [
- {
- id: EVENTS_DATA[0].data.id,
- attributes: EVENTS_DATA[0].data.attributes,
- },
- {
- id: EVENTS_DATA[1].data.id,
- attributes: EVENTS_DATA[1].data.attributes,
- },
- ],
-});
+export const createFormattedHomePageEventsData = () =>
+ formatHomePageEventsData({
+ data: [
+ {
+ id: EVENTS_DATA[0].data.id,
+ attributes: EVENTS_DATA[0].data.attributes,
+ },
+ {
+ id: EVENTS_DATA[1].data.id,
+ attributes: EVENTS_DATA[1].data.attributes,
+ },
+ ],
+ });