mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
28 lines
794 B
TypeScript
28 lines
794 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import NavBar from 'components/NavBar';
|
|
import '@testing-library/jest-dom';
|
|
|
|
describe('NavBar', () => {
|
|
it('renders a title', async () => {
|
|
render(<NavBar />);
|
|
|
|
const heading = await screen.findByText(/RUA!/i);
|
|
|
|
expect(heading).toBeInTheDocument();
|
|
});
|
|
it('renders menu items', async () => {
|
|
render(<NavBar />);
|
|
|
|
const home = await screen.findByText(/Home/i);
|
|
const blog = await screen.findByText(/Blog/i);
|
|
|
|
expect(home).toBeInTheDocument();
|
|
expect(blog).toBeInTheDocument();
|
|
|
|
expect(home.hasAttribute('href')).toBeTruthy();
|
|
expect(home.getAttribute('href')).toEqual('/');
|
|
expect(blog.hasAttribute('href')).toBeTruthy();
|
|
expect(blog.getAttribute('href')).toEqual('/blog');
|
|
});
|
|
});
|