Created
September 30, 2019 14:03
-
-
Save mazikwyry/c5db71fcd9afca9c80fbe40b459f0082 to your computer and use it in GitHub Desktop.
React Testing Library - Given, When, Then
This file contains hidden or 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
describe("when user inputs more characters ", () => { | |
const { getByLabelText, getByText } = render(<Component />); | |
const input = getByLabelText("label", { selector: "input" }); | |
beforeEach(() => { | |
fireEvent.change(input, { target: { value: "new value" } }); | |
}); | |
it("displays suggestions", () => { | |
expect(getByText("new value")).toBeInTheDocument(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment