aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-to-decimal/tests/hex-to-decimal.component.test.js
blob: c98da9ad40ba34cc02838ba1d486a3dbdff36c4c (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
import React from 'react'
import assert from 'assert'
import { shallow } from 'enzyme'
import HexToDecimal from '../hex-to-decimal.component'

describe('HexToDecimal Component', () => {
  it('should render a prefixed hex as a decimal with a className', () => {
    const wrapper = shallow(<HexToDecimal
      value="0x3039"
      className="hex-to-decimal"
    />)

    assert.ok(wrapper.hasClass('hex-to-decimal'))
    assert.equal(wrapper.text(), '12345')
  })

  it('should render an unprefixed hex as a decimal with a className', () => {
    const wrapper = shallow(<HexToDecimal
      value="1A85"
      className="hex-to-decimal"
    />)

    assert.ok(wrapper.hasClass('hex-to-decimal'))
    assert.equal(wrapper.text(), '6789')
  })
})