Skip to content

Commit

Permalink
test(Container): add snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Aug 5, 2021
1 parent 980b617 commit b9da6dc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/Container/Container.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { render } from '@testing-library/react';
import Container from './Container';

describe('Container', () => {
test('should render correctly (snapshot)', () => {
const tree = renderer
.create(
<Container role="main">
<h1>Container</h1>
</Container>
)
.toJSON();
expect(tree).toMatchSnapshot();
});

test('should render children correctly', () => {
const { getByRole } = render(
<Container role="main">
<h1>Container</h1>
</Container>
);
const container = getByRole('main');

expect(container.firstChild).toHaveTextContent('Container');
});
});

0 comments on commit b9da6dc

Please sign in to comment.