Created
May 14, 2020 00:07
-
-
Save arshmakker/cca3bed774aa1a9ce7729f99fff6a6c1 to your computer and use it in GitHub Desktop.
Functional test case fo Header Component
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
//functional testing | |
it('Renders the correct results after the search keyword is entered', () => { | |
render(<Header InitialData={SampleData}/>) | |
fireEvent.change(screen.getByTestId("searchText"), | |
{ target: { value: "2nd" } }) | |
expect(screen.getByTestId("searchText").value).toBe("2nd") | |
fireEvent.click(screen.getByRole('button')) | |
expect(screen.getAllByText(/2nd/i).length).toBe(2) | |
expect(screen.getAllByText(/1st/i).length).toBe(1) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment