2018-05-05 17:11:53 +02:00
|
|
|
import assert from 'assert'
|
2020-11-03 00:41:28 +01:00
|
|
|
import { calcMaxAmount } from '../amount-max-button.utils'
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('amount-max-button utils', function () {
|
|
|
|
describe('calcMaxAmount()', function () {
|
2020-05-29 19:46:10 +02:00
|
|
|
it('should calculate the correct amount when no sendToken defined', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
assert.deepEqual(
|
|
|
|
calcMaxAmount({
|
|
|
|
balance: 'ffffff',
|
|
|
|
gasTotal: 'ff',
|
|
|
|
sendToken: false,
|
|
|
|
}),
|
|
|
|
'ffff00',
|
|
|
|
)
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|
|
|
|
|
2020-05-29 19:46:10 +02:00
|
|
|
it('should calculate the correct amount when a sendToken is defined', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
assert.deepEqual(
|
|
|
|
calcMaxAmount({
|
|
|
|
sendToken: {
|
|
|
|
decimals: 10,
|
|
|
|
},
|
|
|
|
tokenBalance: '64',
|
|
|
|
}),
|
|
|
|
'e8d4a51000',
|
|
|
|
)
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|