Created
June 2, 2018 04:24
-
-
Save qswitcher/29277cfb0d201b99b25f5ea934b4b38e 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('entering a todo in form adds a todo', async () => { | |
const { getByText, getByPlaceholderText, getByTestId, container } = render(<App />); | |
// enter todo text in textbox | |
getByPlaceholderText('Enter todo text').value = 'My new todo'; | |
// click Add | |
Simulate.click(getByText('Add')); | |
// wait for Todo to show up | |
await wait(() => getByText('My new todo')); | |
// make sure form is cleared | |
expect(getByTestId('TodoForm-input').value).toEqual(''); | |
// make sure todo was added | |
expect(getByText('My new todo')).toBeDefined(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment