2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
2022-11-04 21:56:24 +01:00
|
|
|
import { fireEvent } from '@testing-library/react';
|
|
|
|
import configureMockStore from 'redux-mock-store';
|
|
|
|
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
|
|
|
|
import RevealSeedPhrase from '.';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-05-07 15:07:43 +02:00
|
|
|
describe('Reveal Secret Recovery Phrase', () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const TEST_SEED =
|
2021-02-04 19:15:23 +01:00
|
|
|
'debris dizzy just program just float decrease vacant alarm reduce speak stadium';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
seedPhrase: TEST_SEED,
|
|
|
|
setSeedPhraseBackedUp: sinon.spy(),
|
|
|
|
setCompletedOnboarding: sinon.spy(),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2022-11-04 21:56:24 +01:00
|
|
|
const mockState = {
|
|
|
|
metamask: {},
|
|
|
|
};
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2022-11-04 21:56:24 +01:00
|
|
|
const mockStore = configureMockStore()(mockState);
|
|
|
|
|
|
|
|
it('should match snapshot', () => {
|
|
|
|
const { container } = renderWithProvider(
|
|
|
|
<RevealSeedPhrase {...props} />,
|
|
|
|
mockStore,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2022-11-04 21:56:24 +01:00
|
|
|
|
|
|
|
expect(container).toMatchSnapshot();
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2022-11-04 21:56:24 +01:00
|
|
|
it('clicks to reveal shows seed phrase', () => {
|
|
|
|
const { queryByTestId } = renderWithProvider(
|
|
|
|
<RevealSeedPhrase {...props} />,
|
|
|
|
mockStore,
|
|
|
|
);
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2022-11-04 21:56:24 +01:00
|
|
|
fireEvent.click(queryByTestId('reveal-seed-blocker'));
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2022-11-04 21:56:24 +01:00
|
|
|
expect(queryByTestId('showing-seed-phrase')).toBeInTheDocument();
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|