Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(() => {
sendHandler = jest.fn();
({getByTestId} = render());
fireEvent.changeText(getByTestId('messageText'), messageText);
fireEvent.press(getByTestId('sendButton'));
});
public fillAmount(amount: string) {
const input = this.getInput();
fireEvent.changeText(input, amount);
}
beforeEach(() => {
sendHandler = jest.fn();
({ getByTestId } = render());
fireEvent.changeText(getByTestId('messageText'), messageText);
fireEvent.press(getByTestId('sendButton'));
});
it('* emits onChangeText', () => {
const onChangeText = jest.fn();
const component: RenderAPI = renderComponent({ onChangeText });
fireEvent.changeText(component.getByType(TextInput), 'it works!');
expect(onChangeText).toBeCalledWith('it works!');
});
it('* changes text', () => {
const component: RenderAPI = render(
,
);
const input: ReactTestInstance = component.getByType(TextInput);
fireEvent.changeText(input, 'it works!');
const updatedInput: ReactTestInstance = component.getByType(TextInput);
expect(updatedInput.props.value).toEqual('it works!');
});