Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
will-molloy committed Jun 27, 2024
1 parent 5569549 commit 6097796
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { render, screen, fireEvent } from '@testing-library/react';
import { describe, test, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import App from './App';

describe('App Component', () => {
test('renders Vite and React logos with links', () => {
describe('[components] App', () => {
it('renders Vite and React logos with links', () => {
render(<App />);
const viteLogo = screen.getByAltText('Vite logo');
const reactLogo = screen.getByAltText('React logo');
expect(viteLogo).toBeInTheDocument();
expect(reactLogo).toBeInTheDocument();
});

test('renders the heading', () => {
it('renders the heading', () => {
render(<App />);
const heading = screen.getByText('Vite + React');
expect(heading).toBeInTheDocument();
});

test('renders the button and increments count on click', () => {
it('renders the button and increments count on click', () => {
render(<App />);
const button = screen.getByText('count is 0');
expect(button).toBeInTheDocument();
fireEvent.click(button);
expect(button).toHaveTextContent('count is 1');
});

test('renders the instruction text', () => {
it('renders the instruction text', () => {
render(<App />);
const instructionText = screen.getByText('Edit ', { exact: false });
expect(instructionText.textContent).toEqual('Edit src/App.tsx and save to test HMR');
expect(instructionText).toBeInTheDocument();
});

test('renders the footer text', () => {
it('renders the footer text', () => {
render(<App />);
const footerText = screen.getByText('Click on the Vite and React logos to learn more');
expect(footerText).toBeInTheDocument();
Expand Down

0 comments on commit 6097796

Please sign in to comment.