diff --git a/__tests__/pages/collectionspage.test.tsx b/__tests__/pages/collectionspage.test.tsx new file mode 100644 index 00000000..62a9c1ff --- /dev/null +++ b/__tests__/pages/collectionspage.test.tsx @@ -0,0 +1,29 @@ +import { render } from "@testing-library/react"; +import { axe } from "jest-axe"; +import React from "react"; +import { mockCollectionsResponse } from "__tests__/__mocks__/data/mockApiResponses"; +import { CollectionsPage } from "@/src/components/pages/collectionsPage/collectionsPage"; +import CollectionSearchParams from "@/src/types/CollectionSearchParams"; + +jest.mock("next/navigation", () => ({ + useRouter: jest.fn(), + usePathname: jest.fn(), +})); + +describe.skip("Homepage Accessibility", () => { + const searchParams = { + collection_keywords: "flower", + sort: "title-asc", + page: "2", + }; + it("passes axe accessibility test", async () => { + const { container } = render( + + ); + expect(await axe(container)).toHaveNoViolations(); + }, 60000); +}); diff --git a/app/collections/page.tsx b/app/collections/page.tsx index 15fcac35..42b4b680 100644 --- a/app/collections/page.tsx +++ b/app/collections/page.tsx @@ -3,10 +3,10 @@ import { Metadata } from "next"; import { CollectionsPage } from "../src/components/pages/collectionsPage/collectionsPage"; import { getCollectionsData } from "@/src/utils/apiHelpers"; import { redirect } from "next/navigation"; - +import CollectionSearchParams from "@/src/types/CollectionSearchParams"; export type CollectionsProps = { params: { slug: string }; - searchParams: { page: string; sort: string; collection_keywords: string }; + searchParams: CollectionSearchParams; }; export const metadata: Metadata = { @@ -32,7 +32,7 @@ export default async function Collections({ searchParams }: CollectionsProps) { } const renderCollections = - data?.collection !== undefined && data?.collection?.nil; + data?.collection !== undefined && !data?.collection?.nil; return (