-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9d6c17
commit 3bc819d
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { render, screen, fireEvent } from "@testing-library/react"; | ||
import { describe, it, expect, beforeEach } from "vitest"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import LandingPage from "../src/pages/landingPage/landingPage"; // Updated correct path | ||
|
||
describe("Landing Page Navigation Tests", () => { | ||
beforeEach(() => { | ||
render( | ||
<BrowserRouter> | ||
<LandingPage /> | ||
</BrowserRouter> | ||
); | ||
}); | ||
|
||
it("should display landing page with student option and navigate to student page", () => { | ||
// Verify landing page elements are present | ||
expect(screen.getByText(/welcome to/i)).toBeInTheDocument(); | ||
expect(screen.getByText("OHours")).toBeInTheDocument(); | ||
|
||
// Find and click the Students link | ||
const studentLink = screen.getByRole("link", { name: /students/i }); | ||
expect(studentLink).toHaveAttribute("href", "/student"); | ||
|
||
// Verify the Staff option is also present | ||
const staffLink = screen.getByRole("link", { name: /staff/i }); | ||
expect(staffLink).toHaveAttribute("href", "/PMLand"); | ||
}); | ||
}); |