aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js
blob: 710b5d5196c42d326ccefa08fbd792b4476ae04d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react'
import assert from 'assert'
import { shallow } from 'enzyme'
import UserPreferencedCurrencyInput from '../user-preferenced-currency-input.component'
import CurrencyInput from '../../currency-input'

describe('UserPreferencedCurrencyInput Component', () => {
  describe('rendering', () => {
    it('should render properly', () => {
      const wrapper = shallow(
        <UserPreferencedCurrencyInput />
      )

      assert.ok(wrapper)
      assert.equal(wrapper.find(CurrencyInput).length, 1)
    })

    it('should render useFiat for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
      const wrapper = shallow(
        <UserPreferencedCurrencyInput
          useNativeCurrencyAsPrimaryCurrency
        />
      )

      assert.ok(wrapper)
      assert.equal(wrapper.find(CurrencyInput).length, 1)
      assert.equal(wrapper.find(CurrencyInput).props().useFiat, false)
      wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false })
      assert.equal(wrapper.find(CurrencyInput).props().useFiat, true)
    })
  })
})