Project 28: Dashboard Sidebar
React Engineer
Step 1 of 3
Project
Writing a Component Test
Write a test using @testing-library/react: render(<Sidebar />), then screen.getByText("Dashboard") to assert the link is there. Testing Library deliberately queries the rendered output the way a user would find it (by visible text, by role) rather than reaching into component internals.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
import { render, screen } from "@testing-library/react";
import Sidebar from "./Sidebar";
test("renders the Dashboard link", () => {
render(<Sidebar />);
expect(screen.getByText("Dashboard")).toBeInTheDocument();
});