Last active
January 13, 2021 21:02
-
-
Save mariocsantos/84a07fcb2dcf2a312019f6a6ed55dcb2 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
import React from 'react'; | |
import { render, screen } from '@testing-library/react'; | |
import userEvent from '@testing-library/user-event'; | |
import { FavoriteFood } from '../FavoriteFood'; | |
describe('FavoriteFood', () => { | |
it('should disable add food button', () => { | |
render(<FavoriteFood />); | |
expect(screen.getByRole('button')).toBeDisabled(); | |
}); | |
it('should enable add food button', () => { | |
render(<FavoriteFood />); | |
const input = screen.getByLabelText(/Favorite food/i); | |
userEvent.type(input, 'Taco 🌮'); | |
expect(screen.getByRole('button')).toBeEnabled(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment