aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
blob: bd3c9a257abcd9461c8e69357f7090c0fa8b3390 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import assert from 'assert'
import {
  gasFeeIsInError,
  getGasLoadingError,
  getGasButtonGroupShown,
} from '../send-gas-row.selectors.js'

describe('send-gas-row selectors', () => {

  describe('getGasLoadingError()', () => {
    it('should return send.errors.gasLoading', () => {
      const state = {
        send: {
          errors: {
            gasLoading: 'abc',
          },
        },
      }

      assert.equal(getGasLoadingError(state), 'abc')
    })
  })

  describe('gasFeeIsInError()', () => {
    it('should return true if send.errors.gasFee is truthy', () => {
      const state = {
        send: {
          errors: {
            gasFee: 'def',
          },
        },
      }

      assert.equal(gasFeeIsInError(state), true)
    })

    it('should return false send.errors.gasFee is falsely', () => {
      const state = {
        send: {
          errors: {
            gasFee: null,
          },
        },
      }

      assert.equal(gasFeeIsInError(state), false)
    })
  })

  describe('getGasButtonGroupShown()', () => {
    it('should return send.gasButtonGroupShown', () => {
      const state = {
        send: {
          gasButtonGroupShown: 'foobar',
        },
      }

      assert.equal(getGasButtonGroupShown(state), 'foobar')
    })
  })

})