Created
June 11, 2020 04:23
-
-
Save Dromediansk/4148312f22b31d054aac81d54e946116 to your computer and use it in GitHub Desktop.
Filtering countries test
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
it("should filter countries by name when input value is changed", () => { | |
useFetch.mockReturnValue({ | |
loading: false, | |
data: stubbedCountries, | |
error: null, | |
}); | |
const { getByTestId } = render(<CountriesContainer />); | |
act(() => { | |
fireEvent.change(getByTestId("filter-input-name"), { | |
target: { value: "Slov" }, | |
}); | |
}); | |
expect(getByTestId("countries-container").children).toHaveLength(1); | |
expect(getByTestId("countries-container").textContent).toContain( | |
"Slovakia" | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment