Skip to content

Commit

Permalink
test(FlexContainer): add snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Aug 5, 2021
1 parent b9da6dc commit 7d03d9f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/FlexContainer/FlexContainer.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 FlexContainer from './FlexContainer';

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

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

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

0 comments on commit 7d03d9f

Please sign in to comment.