You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
import React from 'react';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import { fireEvent } from '@testing-library/react';
|
|
import thunk from 'redux-thunk';
|
|
import { renderWithProvider } from '../../../test/lib/render-helpers';
|
|
import RevealSeedPage from './reveal-seed';
|
|
|
|
const mockRequestRevealSeedWords = jest.fn().mockResolvedValue();
|
|
|
|
jest.mock('../../store/actions.js', () => ({
|
|
requestRevealSeedWords: () => mockRequestRevealSeedWords,
|
|
}));
|
|
|
|
describe('Reveal Seed Page', () => {
|
|
const mockState = {
|
|
history: {
|
|
mostRecentOverviewPage: '/',
|
|
},
|
|
};
|
|
const mockStore = configureMockStore([thunk])(mockState);
|
|
|
|
it('should match snapshot', () => {
|
|
const { container } = renderWithProvider(<RevealSeedPage />, mockStore);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('form submit', () => {
|
|
const { queryByTestId, queryByText } = renderWithProvider(
|
|
<RevealSeedPage />,
|
|
mockStore,
|
|
);
|
|
|
|
fireEvent.change(queryByTestId('input-password'), {
|
|
target: { value: 'password' },
|
|
});
|
|
|
|
fireEvent.click(queryByText('Next'));
|
|
|
|
expect(mockRequestRevealSeedWords).toHaveBeenCalled();
|
|
});
|
|
});
|
|
|