Skip to content

Commit

Permalink
feat: Write unit tests for Nav component
Browse files Browse the repository at this point in the history
  • Loading branch information
steezplusplus committed Sep 12, 2023
1 parent 6b72fd8 commit 0112383
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions app/_components/nav/nav.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { render, screen } from '@testing-library/react';
import { Nav } from './nav';

describe('<Nav />', () => {
it('Should render an anchor', () => {
render(<Nav />);
const anchor = screen.getByRole('link');
expect(anchor).toBeInTheDocument();
});
it('Should render a heading', () => {
render(<Nav />);
const heading = screen.getByRole('heading', {
level: 1,
});
expect(heading).toBeInTheDocument();
});
});
File renamed without changes.
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import { Lora } from 'next/font/google';

import './globals.css';
import { Nav } from './_components/nav';
import { Nav } from './_components/nav/nav';
import { Footer } from './_components/footer';
import { Providers } from './_components/providers';

Expand Down

0 comments on commit 0112383

Please sign in to comment.