mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-05 15:35:46 +01:00
6640973858
* Adding missing required props to component tests * Removing unused IntroPopup component * Mocking useLayoutEffect as useEffect in confirm-page-container-header.component.test.js
66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
import React from 'react';
|
|
import sinon from 'sinon';
|
|
import { shallow } from 'enzyme';
|
|
import TextField from '../../../components/ui/text-field';
|
|
import AdvancedTab from './advanced-tab.component';
|
|
|
|
describe('AdvancedTab Component', () => {
|
|
it('should render correctly when threeBoxFeatureFlag', () => {
|
|
const root = shallow(
|
|
<AdvancedTab
|
|
ipfsGateway=""
|
|
setAutoLockTimeLimit={() => undefined}
|
|
setIpfsGateway={() => undefined}
|
|
setShowFiatConversionOnTestnetsPreference={() => undefined}
|
|
setThreeBoxSyncingPermission={() => undefined}
|
|
threeBoxDisabled
|
|
threeBoxSyncingAllowed={false}
|
|
useLedgerLive={false}
|
|
setLedgerLivePreference={() => undefined}
|
|
setDismissSeedBackUpReminder={() => undefined}
|
|
dismissSeedBackUpReminder={false}
|
|
/>,
|
|
{
|
|
context: {
|
|
t: (s) => `_${s}`,
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(root.find('.settings-page__content-row')).toHaveLength(12);
|
|
});
|
|
|
|
it('should update autoLockTimeLimit', () => {
|
|
const setAutoLockTimeLimitSpy = sinon.spy();
|
|
const root = shallow(
|
|
<AdvancedTab
|
|
ipfsGateway=""
|
|
setAutoLockTimeLimit={setAutoLockTimeLimitSpy}
|
|
setIpfsGateway={() => undefined}
|
|
setShowFiatConversionOnTestnetsPreference={() => undefined}
|
|
setThreeBoxSyncingPermission={() => undefined}
|
|
threeBoxDisabled
|
|
threeBoxSyncingAllowed={false}
|
|
useLedgerLive={false}
|
|
setLedgerLivePreference={() => undefined}
|
|
setDismissSeedBackUpReminder={() => undefined}
|
|
dismissSeedBackUpReminder={false}
|
|
/>,
|
|
{
|
|
context: {
|
|
t: (s) => `_${s}`,
|
|
},
|
|
},
|
|
);
|
|
|
|
const autoTimeout = root.find('.settings-page__content-row').at(7);
|
|
const textField = autoTimeout.find(TextField);
|
|
|
|
textField.props().onChange({ target: { value: 1440 } });
|
|
expect(root.state().autoLockTimeLimit).toStrictEqual(1440);
|
|
|
|
autoTimeout.find('.settings-tab__rpc-save-button').simulate('click');
|
|
expect(setAutoLockTimeLimitSpy.args[0][0]).toStrictEqual(1440);
|
|
});
|
|
});
|