mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
8fbd1e30e8
* MMI-2657 adds the compliance settings screen * MMI-2657 adds stories file * wip compliance feature page * adds stories and fixes imports * adds storybook and tests * lint fix
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: {
|
|
provider: {
|
|
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();
|
|
});
|
|
});
|