@brightlayer-ui/react-native-auth-workflow
Version:
Re-usable workflow components for Authentication and Registration within Eaton applications.
25 lines (24 loc) • 1.09 kB
JavaScript
import React from 'react';
import { cleanup, fireEvent, render, screen } from '@testing-library/react-native';
import { SuccessScreenBase } from '../../screens/SuccessScreen/SuccessScreenBase';
import { Provider as PaperProvider } from 'react-native-paper';
describe('SuccessScreenBase Test', () => {
afterEach(cleanup);
const onDismiss = jest.fn();
it('SuccessScreenBase renders correctly', () => {
render(React.createElement(PaperProvider, null,
React.createElement(SuccessScreenBase, null))).toJSON();
expect(render).toBeTruthy();
});
it('should call onDismiss, when Dismiss button is pressed', () => {
render(React.createElement(PaperProvider, null,
React.createElement(SuccessScreenBase, { WorkflowCardActionsProps: {
nextLabel: 'Dismiss',
canGoNext: true,
showNext: true,
onNext: () => onDismiss(),
} })));
fireEvent.press(screen.getByText('Dismiss'));
expect(onDismiss).toHaveBeenCalled();
});
});