mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
d1cea85f33
* Rename `provider` to `providerConfig` The network controller `provider` state has been renamed to `providerConfig`. This better reflects what this state is, and makes this controller more closely aligned with the core network controller. All references to the provider configuration have been updated to prefer `providerConfig` over `provider`, to make the distinction clear between a provider and provider config. Closes #18902 * Add migration
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { fireEvent } from '@testing-library/react';
|
|
import reactRouterDom from 'react-router-dom';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import thunk from 'redux-thunk';
|
|
import {
|
|
renderWithProvider,
|
|
setBackgroundConnection,
|
|
} from '../../../../test/jest';
|
|
import PinExtension from './pin-extension';
|
|
|
|
const completeOnboardingStub = jest
|
|
.fn()
|
|
.mockImplementation(() => Promise.resolve());
|
|
|
|
describe('Creation Successful Onboarding View', () => {
|
|
const mockStore = {
|
|
metamask: {
|
|
providerConfig: {
|
|
type: 'test',
|
|
},
|
|
},
|
|
};
|
|
const store = configureMockStore([thunk])(mockStore);
|
|
setBackgroundConnection({ completeOnboarding: completeOnboardingStub });
|
|
|
|
const pushMock = jest.fn();
|
|
beforeAll(() => {
|
|
jest
|
|
.spyOn(reactRouterDom, 'useHistory')
|
|
.mockImplementation()
|
|
.mockReturnValue({ push: pushMock });
|
|
});
|
|
|
|
it('should call completeOnboarding in the background when Done" button is clicked', () => {
|
|
const { getByText } = renderWithProvider(<PinExtension />, store);
|
|
const nextButton = getByText('Next');
|
|
fireEvent.click(nextButton);
|
|
const gotItButton = getByText('Done');
|
|
fireEvent.click(gotItButton);
|
|
expect(completeOnboardingStub).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|