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.
64 lines
1.8 KiB
64 lines
1.8 KiB
4 years ago
|
import React from 'react';
|
||
|
import sinon from 'sinon';
|
||
|
import { mount } from 'enzyme';
|
||
4 years ago
|
import SecurityTab from './security-tab.container';
|
||
5 years ago
|
|
||
4 years ago
|
describe('Security Tab', () => {
|
||
4 years ago
|
let wrapper;
|
||
5 years ago
|
|
||
|
const props = {
|
||
|
revealSeedConfirmation: sinon.spy(),
|
||
|
showClearApprovalModal: sinon.spy(),
|
||
|
setParticipateInMetaMetrics: sinon.spy(),
|
||
|
displayWarning: sinon.spy(),
|
||
4 years ago
|
showIncomingTransactions: false,
|
||
5 years ago
|
setShowIncomingTransactionsFeatureFlag: sinon.spy(),
|
||
|
history: {
|
||
|
push: sinon.spy(),
|
||
|
},
|
||
|
privacyMode: true,
|
||
|
warning: '',
|
||
|
participateInMetaMetrics: false,
|
||
5 years ago
|
setUsePhishDetect: sinon.spy(),
|
||
|
usePhishDetect: true,
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
beforeEach(() => {
|
||
4 years ago
|
wrapper = mount(<SecurityTab.WrappedComponent {...props} />, {
|
||
|
context: {
|
||
|
t: (str) => str,
|
||
|
metricsEvent: () => undefined,
|
||
4 years ago
|
},
|
||
4 years ago
|
});
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('navigates to reveal seed words page', () => {
|
||
4 years ago
|
const seedWords = wrapper.find('.button.btn-danger.btn--large');
|
||
5 years ago
|
|
||
4 years ago
|
seedWords.simulate('click');
|
||
4 years ago
|
expect(props.history.push.calledOnce).toStrictEqual(true);
|
||
|
expect(props.history.push.getCall(0).args[0]).toStrictEqual('/seed');
|
||
4 years ago
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('toggles incoming txs', () => {
|
||
4 years ago
|
const incomingTxs = wrapper.find({ type: 'checkbox' }).at(0);
|
||
|
incomingTxs.simulate('click');
|
||
4 years ago
|
expect(
|
||
|
props.setShowIncomingTransactionsFeatureFlag.calledOnce,
|
||
|
).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('toggles phishing detection', () => {
|
||
4 years ago
|
const phishDetect = wrapper.find({ type: 'checkbox' }).at(1);
|
||
|
phishDetect.simulate('click');
|
||
4 years ago
|
expect(props.setUsePhishDetect.calledOnce).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('toggles metaMetrics', () => {
|
||
4 years ago
|
const metaMetrics = wrapper.find({ type: 'checkbox' }).at(2);
|
||
5 years ago
|
|
||
4 years ago
|
metaMetrics.simulate('click');
|
||
4 years ago
|
expect(props.setParticipateInMetaMetrics.calledOnce).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
|
});
|