Skip to content

Commit 5bed74b

Browse files
committed
Add tests
1 parent 46a3ba0 commit 5bed74b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1195
-939
lines changed

finished-application/frontend/__tests__/AddToCart.test.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

finished-application/frontend/__tests__/Cart.test.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

finished-application/frontend/__tests__/CartCount.test.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import { render } from '@testing-library/react';
2-
import waait from 'waait';
1+
import { render, screen } from '@testing-library/react';
2+
import wait from 'waait';
33
import CartCount from '../components/CartCount';
44

55
describe('<CartCount/>', () => {
6-
it('renders', () => {
6+
it('Renders', () => {
77
render(<CartCount count={10} />);
88
});
9-
10-
it('matches the snapshot', () => {
9+
it('Matches snapshot', () => {
1110
const { container } = render(<CartCount count={11} />);
1211
expect(container).toMatchSnapshot();
1312
});
14-
1513
it('updates via props', async () => {
1614
const { container, rerender, debug } = render(<CartCount count={11} />);
1715
expect(container.textContent).toBe('11');
18-
rerender(<CartCount count={12} />);
16+
// expect(container).toHaveTextContent('11');
17+
// Update the props
18+
rerender(<CartCount count="12" />);
19+
// wait for __ ms
1920
expect(container.textContent).toBe('1211');
20-
await waait(500);
21+
await wait(400);
2122
expect(container.textContent).toBe('12');
2223
expect(container).toMatchSnapshot();
2324
});

finished-application/frontend/__tests__/Checkout.test.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)