1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/institutional/compliance-settings/compliance-settings.test.js

68 lines
1.7 KiB
JavaScript
Raw Normal View History

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();
});
});