Created
February 22, 2020 23:25
-
-
Save darde/2ec50359339177ed57b60d2a5ecd2e60 to your computer and use it in GitHub Desktop.
Medium store - Testing asynchronous code with Jest and Testing Library React - src/App.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render, cleanup } from '@testing-library/react'; | |
import App from './App'; | |
describe('App', () => { | |
describe('when the fetch operation is pending', () => { | |
it('shows a loading span', () => { | |
const { getByText } = render(<App />); | |
expect(getByText(/loading/i)).toBeInTheDocument(); | |
cleanup(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment