Created
April 27, 2022 20:51
-
-
Save tanner-west/dcd15b6e7bdf09bcc69577fbb6b70d40 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import {fireEvent, render} from '@testing-library/react-native'; | |
import Name from './Name'; | |
describe('<Name />', () => { | |
let getByText: any, getByTestId: any; | |
beforeEach(() => { | |
({getByText, getByTestId} = render(<Name />)); | |
}); | |
it("should render 'get started' message", () => { | |
getByText('Please type your name to get started'); | |
}); | |
it("should render 'Your name is: Ray Bradbury'", () => { | |
const nameInput = getByTestId('name-input'); | |
fireEvent(nameInput, 'onChangeText', 'Ray Bradbury'); | |
getByText('Your name is: Ray Bradbury'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment