Relative Content

Tag Archive for javascriptreactjsunit-testingjestjsautomated-tests

Unit test failing because fest.fn() not trigger openConfirmationModal function

it(‘text field’, async () => { const props = { openConfirmationModal: jest.fn() } const { queryByTestId, findByTestId } = render( <FormInputs openConfirmationModal={props.openConfirmationModal} /> ); const input = queryByTestId(‘input-component-amount’) as HTMLInputElement; expect(input).toBeInTheDocument(); fireEvent.change(input, { target: { value: 123 } }); const textArea = queryByTestId(‘textarea-component-textfield’) as HTMLTextAreaElement; expect(textArea).toBeInTheDocument(); fireEvent.change(textArea, { target: { value: ‘This is some text!’ […]

Unit test failing because fest.fn() not trigger openConfirmationModal function

it(‘text field’, async () => { const props = { openConfirmationModal: jest.fn() } const { queryByTestId, findByTestId } = render( <FormInputs openConfirmationModal={props.openConfirmationModal} /> ); const input = queryByTestId(‘input-component-amount’) as HTMLInputElement; expect(input).toBeInTheDocument(); fireEvent.change(input, { target: { value: 123 } }); const textArea = queryByTestId(‘textarea-component-textfield’) as HTMLTextAreaElement; expect(textArea).toBeInTheDocument(); fireEvent.change(textArea, { target: { value: ‘This is some text!’ […]

Unit test failing because fest.fn() not trigger openConfirmationModal function

it(‘text field’, async () => { const props = { openConfirmationModal: jest.fn() } const { queryByTestId, findByTestId } = render( <FormInputs openConfirmationModal={props.openConfirmationModal} /> ); const input = queryByTestId(‘input-component-amount’) as HTMLInputElement; expect(input).toBeInTheDocument(); fireEvent.change(input, { target: { value: 123 } }); const textArea = queryByTestId(‘textarea-component-textfield’) as HTMLTextAreaElement; expect(textArea).toBeInTheDocument(); fireEvent.change(textArea, { target: { value: ‘This is some text!’ […]