2019-05-08 20:57:21 +02:00
|
|
|
import assert from 'assert'
|
2020-08-18 21:18:25 +02:00
|
|
|
import React from 'react'
|
2019-05-08 20:57:21 +02:00
|
|
|
import sinon from 'sinon'
|
|
|
|
import { shallow } from 'enzyme'
|
|
|
|
import AdvancedTab from '../advanced-tab.component'
|
|
|
|
import TextField from '../../../../components/ui/text-field'
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('AdvancedTab Component', function () {
|
|
|
|
it('should render correctly when threeBoxFeatureFlag', function () {
|
2019-05-08 20:57:21 +02:00
|
|
|
const root = shallow(
|
2020-01-14 22:15:54 +01:00
|
|
|
<AdvancedTab
|
|
|
|
ipfsGateway=""
|
2020-08-14 13:47:02 +02:00
|
|
|
setAutoLockTimeLimit={() => undefined}
|
|
|
|
setIpfsGateway={() => undefined}
|
|
|
|
setShowFiatConversionOnTestnetsPreference={() => undefined}
|
|
|
|
setThreeBoxSyncingPermission={() => undefined}
|
2020-01-14 22:15:54 +01:00
|
|
|
threeBoxDisabled
|
|
|
|
threeBoxSyncingAllowed={false}
|
|
|
|
/>,
|
2019-05-08 20:57:21 +02:00
|
|
|
{
|
|
|
|
context: {
|
2020-02-15 21:34:12 +01:00
|
|
|
t: (s) => `_${s}`,
|
2019-05-08 20:57:21 +02:00
|
|
|
},
|
2020-07-14 17:20:41 +02:00
|
|
|
},
|
2019-05-08 20:57:21 +02:00
|
|
|
)
|
|
|
|
|
2020-06-12 20:46:01 +02:00
|
|
|
assert.equal(root.find('.settings-page__content-row').length, 11)
|
2019-09-16 19:11:01 +02:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should update autoLockTimeLimit', function () {
|
2020-01-21 23:09:53 +01:00
|
|
|
const setAutoLockTimeLimitSpy = sinon.spy()
|
2019-05-08 20:57:21 +02:00
|
|
|
const root = shallow(
|
|
|
|
<AdvancedTab
|
2020-01-14 22:15:54 +01:00
|
|
|
ipfsGateway=""
|
2020-01-21 23:09:53 +01:00
|
|
|
setAutoLockTimeLimit={setAutoLockTimeLimitSpy}
|
2020-08-14 13:47:02 +02:00
|
|
|
setIpfsGateway={() => undefined}
|
|
|
|
setShowFiatConversionOnTestnetsPreference={() => undefined}
|
|
|
|
setThreeBoxSyncingPermission={() => undefined}
|
2020-01-14 22:15:54 +01:00
|
|
|
threeBoxDisabled
|
|
|
|
threeBoxSyncingAllowed={false}
|
2019-05-08 20:57:21 +02:00
|
|
|
/>,
|
|
|
|
{
|
|
|
|
context: {
|
2020-02-15 21:34:12 +01:00
|
|
|
t: (s) => `_${s}`,
|
2019-05-08 20:57:21 +02:00
|
|
|
},
|
2020-07-14 17:20:41 +02:00
|
|
|
},
|
2019-05-08 20:57:21 +02:00
|
|
|
)
|
|
|
|
|
2020-06-12 20:46:01 +02:00
|
|
|
const autoTimeout = root.find('.settings-page__content-row').at(8)
|
2019-05-08 20:57:21 +02:00
|
|
|
const textField = autoTimeout.find(TextField)
|
|
|
|
|
|
|
|
textField.props().onChange({ target: { value: 1440 } })
|
2020-01-21 23:09:53 +01:00
|
|
|
assert.equal(root.state().autoLockTimeLimit, 1440)
|
2019-05-08 20:57:21 +02:00
|
|
|
|
2019-10-17 17:25:37 +02:00
|
|
|
autoTimeout.find('.settings-tab__rpc-save-button').simulate('click')
|
2020-01-21 23:09:53 +01:00
|
|
|
assert.equal(setAutoLockTimeLimitSpy.args[0][0], 1440)
|
2019-05-08 20:57:21 +02:00
|
|
|
})
|
|
|
|
})
|