Skip to content

Commit

Permalink
test and clean up bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
avertrees committed Dec 12, 2024
1 parent b0034e4 commit a56c713
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
29 changes: 29 additions & 0 deletions __tests__/pages/collectionspage.test.tsx
Original file line number Diff line number Diff line change
@@ -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(
<CollectionsPage
data={mockCollectionsResponse}
params={searchParams}
renderCollections={true}
/>
);
expect(await axe(container)).toHaveNoViolations();
}, 60000);
});
6 changes: 3 additions & 3 deletions app/collections/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 (
<Suspense>
Expand Down

0 comments on commit a56c713

Please sign in to comment.