Created
June 12, 2020 17:06
-
-
Save moshfiqrony/b585e608ac86a22529c7357708f5d347 to your computer and use it in GitHub Desktop.
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
test('Component rendered successfully', async () => { | |
axios.get.mockImplementationOnce(() => Promise.resolve({ | |
status: 200, | |
data: { | |
name: 'Rony', | |
email: '[email protected]' | |
} | |
})) | |
const { container, getByTestId } = render(<ApiCallMock />); | |
expect(container.textContent).toMatch('Loading Data..') | |
await waitFor(() => expect(getByTestId('name').textContent).toMatch('Rony')) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment