2018-10-17 01:03:29 +02:00
|
|
|
import React from 'react'
|
|
|
|
import assert from 'assert'
|
|
|
|
import { shallow } from 'enzyme'
|
|
|
|
import UserPreferencedTokenInput from '../user-preferenced-token-input.component'
|
|
|
|
import TokenInput from '../../token-input'
|
|
|
|
|
|
|
|
describe('UserPreferencedCurrencyInput Component', () => {
|
|
|
|
describe('rendering', () => {
|
|
|
|
it('should render properly', () => {
|
|
|
|
const wrapper = shallow(
|
|
|
|
<UserPreferencedTokenInput />
|
|
|
|
)
|
|
|
|
|
|
|
|
assert.ok(wrapper)
|
|
|
|
assert.equal(wrapper.find(TokenInput).length, 1)
|
|
|
|
})
|
|
|
|
|
2018-10-26 10:26:43 +02:00
|
|
|
it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
|
2018-10-17 01:03:29 +02:00
|
|
|
const wrapper = shallow(
|
|
|
|
<UserPreferencedTokenInput
|
2018-10-26 10:26:43 +02:00
|
|
|
useNativeCurrencyAsPrimaryCurrency
|
2018-10-17 01:03:29 +02:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
|
|
|
|
assert.ok(wrapper)
|
|
|
|
assert.equal(wrapper.find(TokenInput).length, 1)
|
|
|
|
assert.equal(wrapper.find(TokenInput).props().showFiat, false)
|
2018-10-26 10:26:43 +02:00
|
|
|
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false })
|
2018-10-17 01:03:29 +02:00
|
|
|
assert.equal(wrapper.find(TokenInput).props().showFiat, true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|