aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js
blob: 1ee858f67971dad63f3c128a79b6cd29d63180d9 (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
import assert from 'assert'
import {
  calcMaxAmount,
} from '../amount-max-button.utils.js'

describe('amount-max-button utils', () => {

  describe('calcMaxAmount()', () => {
    it('should calculate the correct amount when no selectedToken defined', () => {
      assert.deepEqual(calcMaxAmount({
        balance: 'ffffff',
        gasTotal: 'ff',
        selectedToken: false,
      }), 'ffff00')
    })

    it('should calculate the correct amount when a selectedToken is defined', () => {
      assert.deepEqual(calcMaxAmount({
        selectedToken: {
          decimals: 10,
        },
        tokenBalance: '64',
      }), 'e8d4a51000')
    })
  })

})