mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +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
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|
import ComplianceSettings from '.';
|
|
|
|
const mockedDeleteComplianceAuthData = jest
|
|
.fn()
|
|
.mockReturnValue({ type: 'TYPE' });
|
|
jest.mock('../../../store/institutional/institution-background', () => ({
|
|
mmiActionsFactory: () => ({
|
|
deleteComplianceAuthData: mockedDeleteComplianceAuthData,
|
|
}),
|
|
}));
|
|
|
|
const mockStore = {
|
|
metamask: {
|
|
providerConfig: {
|
|
type: 'test',
|
|
},
|
|
institutionalFeatures: {
|
|
complianceProjectId: '',
|
|
complianceClientId: '',
|
|
reportsInProgress: {},
|
|
},
|
|
preferences: {
|
|
useNativeCurrencyAsPrimaryCurrency: true,
|
|
},
|
|
},
|
|
};
|
|
|
|
describe('Compliance Settings', () => {
|
|
it('shows start btn when Compliance its not activated', () => {
|
|
const store = configureMockStore()(mockStore);
|
|
|
|
const { container, getByTestId } = renderWithProvider(
|
|
<ComplianceSettings />,
|
|
store,
|
|
);
|
|
|
|
expect(getByTestId('start-compliance')).toBeVisible();
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('shows disconnect when Compliance is activated', () => {
|
|
const customMockStore = {
|
|
...mockStore,
|
|
metamask: {
|
|
...mockStore.metamask,
|
|
institutionalFeatures: {
|
|
complianceProjectId: '123',
|
|
complianceClientId: '123',
|
|
reportsInProgress: {},
|
|
},
|
|
},
|
|
};
|
|
|
|
const store = configureMockStore()(customMockStore);
|
|
|
|
const { container, getByTestId } = renderWithProvider(
|
|
<ComplianceSettings />,
|
|
store,
|
|
);
|
|
|
|
expect(getByTestId('disconnect-compliance')).toBeVisible();
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
});
|