chore: added basic jest testing support
also added an example test for the counter in the components.tsx file to demonstrate functionality of testing configuration. installed all dependencies for testing using --save-dev to make sure they are stored as dev dependencies ref: N25B-212
This commit is contained in:
12
test/components.test.tsx
Normal file
12
test/components.test.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { render, screen} from '@testing-library/react';
|
||||
import Counter from '../src/components/components';
|
||||
|
||||
describe('Counter component', () => {
|
||||
test('increments count', async () => {
|
||||
render(<Counter />);
|
||||
const button = screen.getByRole('button', { name: /count is 0/i });
|
||||
await userEvent.click(button);
|
||||
expect(screen.getByText(/count is 1/i)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user