2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
2022-08-09 17:37:29 +02:00
|
|
|
import { fireEvent, screen } from '@testing-library/react';
|
|
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
2021-03-16 22:00:08 +01:00
|
|
|
import SelectAction from './select-action.container';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Selection Action', () => {
|
2020-01-30 20:34:45 +01:00
|
|
|
const props = {
|
|
|
|
isInitialized: false,
|
|
|
|
setFirstTimeFlowType: sinon.spy(),
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
beforeEach(() => {
|
2022-08-09 17:37:29 +02:00
|
|
|
renderWithProvider(<SelectAction.WrappedComponent {...props} />);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
afterEach(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
props.setFirstTimeFlowType.resetHistory();
|
|
|
|
props.history.push.resetHistory();
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('clicks import wallet to route to import FTF', () => {
|
2022-08-09 17:37:29 +02:00
|
|
|
const importButton = screen.getByTestId('import-wallet-button');
|
|
|
|
fireEvent.click(importButton);
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(props.setFirstTimeFlowType.calledOnce).toStrictEqual(true);
|
|
|
|
expect(props.setFirstTimeFlowType.getCall(0).args[0]).toStrictEqual(
|
|
|
|
'import',
|
|
|
|
);
|
|
|
|
expect(props.history.push.calledOnce).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('clicks create wallet to route to create FTF', () => {
|
2022-08-09 17:37:29 +02:00
|
|
|
const importButton = screen.getByTestId('create-wallet-button');
|
|
|
|
fireEvent.click(importButton);
|
2021-02-04 19:15:23 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(props.setFirstTimeFlowType.calledOnce).toStrictEqual(true);
|
|
|
|
expect(props.setFirstTimeFlowType.getCall(0).args[0]).toStrictEqual(
|
|
|
|
'create',
|
|
|
|
);
|
|
|
|
expect(props.history.push.calledOnce).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|