2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
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-12-03 16:46:22 +01:00
|
|
|
assert.deepStrictEqual(
|
2020-11-03 00:41:28 +01:00
|
|
|
calcMaxAmount({
|
|
|
|
balance: 'ffffff',
|
|
|
|
gasTotal: 'ff',
|
|
|
|
sendToken: false,
|
|
|
|
}),
|
|
|
|
'ffff00',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
});
|
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-12-03 16:46:22 +01:00
|
|
|
assert.deepStrictEqual(
|
2020-11-03 00:41:28 +01:00
|
|
|
calcMaxAmount({
|
|
|
|
sendToken: {
|
|
|
|
decimals: 10,
|
|
|
|
},
|
|
|
|
tokenBalance: '64',
|
|
|
|
}),
|
|
|
|
'e8d4a51000',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|