From e8aa4590d8422c40c1fed2a6b1671a1f86a79b90 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 14 Jan 2025 12:53:32 -0500 Subject: [PATCH] Move the NotFound test to playwright. --- frontend/e2e/notFound.spec.ts | 2 +- frontend/src/components/NotFound.test.tsx | 30 ----------------------- frontend/src/components/NotFound.tsx | 3 ++- 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 frontend/src/components/NotFound.test.tsx diff --git a/frontend/e2e/notFound.spec.ts b/frontend/e2e/notFound.spec.ts index 252098fc6..c6771a414 100644 --- a/frontend/e2e/notFound.spec.ts +++ b/frontend/e2e/notFound.spec.ts @@ -2,5 +2,5 @@ import { test, expect } from '@playwright/test'; test('shows 404 page for non-existent routes', async ({ page }) => { await page.goto('/#/non-existent-route'); - await expect(page.getByText('Page not found')).toBeVisible(); + await expect(page.getByText('Page Not Found')).toBeVisible(); }); diff --git a/frontend/src/components/NotFound.test.tsx b/frontend/src/components/NotFound.test.tsx deleted file mode 100644 index ae0005cb1..000000000 --- a/frontend/src/components/NotFound.test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, test } from "vitest"; -import { render, screen } from "@testing-library/react"; -import { MemoryRouter, Route, Routes } from "react-router"; -import NotFound from "./NotFound"; - -interface NotFoundTestParams { - path: string; - expectedText: string; -} - -const testCases: NotFoundTestParams[] = [ - { - path: "/random-path", - expectedText: "404 Not Found", - }, -]; - -describe.each(testCases)("NotFound Component", ({ path, expectedText }) => { - const testName = `Render correctly when navigating to '${path}'`; - test(testName, () => { - render( - - - } /> - - , - ); - expect(screen.getByText(expectedText)).not.toBeNull(); - }); -}); diff --git a/frontend/src/components/NotFound.tsx b/frontend/src/components/NotFound.tsx index 415235b48..eee917cc9 100644 --- a/frontend/src/components/NotFound.tsx +++ b/frontend/src/components/NotFound.tsx @@ -1,5 +1,6 @@ import { Link } from "react-router"; import { useContext } from "react"; + import { ThemeContext } from "../context/ThemeContext"; const NotFound = () => { @@ -10,7 +11,7 @@ const NotFound = () => {

- 404 Not Found + Page Not Found

Sorry, the page you're looking for doesn't exist.