Skip to content

Instantly share code, notes, and snippets.

@CodingItWrong
Created January 4, 2019 02:38
Show Gist options
  • Save CodingItWrong/7128c13475a4606267cb437bd78dcc14 to your computer and use it in GitHub Desktop.
Save CodingItWrong/7128c13475a4606267cb437bd78dcc14 to your computer and use it in GitHub Desktop.
import React from 'react';
import { render, fireEvent } from 'react-native-testing-library';
import NewMessageForm from '../../NewMessageForm';
describe('NewMessageForm', () => {
describe('clicking send', () => {
const messageText = 'Hello world';
let getByTestId;
beforeEach(() => {
({ getByTestId } = render(<NewMessageForm />));
fireEvent.changeText(getByTestId('messageText'), messageText);
fireEvent.press(getByTestId('sendButton'));
});
it('clears the message field', () => {
expect(getByTestId('messageText').props.value).toEqual('');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment