|
2 | 2 | const assert = require('assert'); |
3 | 3 | const sinon = require('sinon'); |
4 | 4 | const AccountParser = require('../lib/contracts/accountParser'); |
| 5 | +const utils = require('../lib/utils/utils'); |
5 | 6 | let TestLogger = require('../lib/tests/test_logger.js'); |
6 | 7 | const Web3 = require('web3'); |
7 | 8 | const i18n = require('../lib/i18n/i18n.js'); |
@@ -75,38 +76,38 @@ describe('embark.AccountParser', function () { |
75 | 76 |
|
76 | 77 | describe('getHexBalance', () => { |
77 | 78 | it('should return default if no balance', () => { |
78 | | - const hexBalance = AccountParser.getHexBalance(null, Web3); |
| 79 | + const hexBalance = utils.getHexBalanceFromString(null, Web3); |
79 | 80 |
|
80 | 81 | assert.strictEqual(hexBalance, 0xFFFFFFFFFFFFFFFFFF); |
81 | 82 | }); |
82 | 83 |
|
83 | 84 | it('should return the balance string if already hexadecimal', () => { |
84 | | - const hexBalance = AccountParser.getHexBalance('0xFFF', Web3); |
| 85 | + const hexBalance = utils.getHexBalanceFromString('0xFFF', Web3); |
85 | 86 |
|
86 | 87 | assert.strictEqual(hexBalance, '0xFFF'); |
87 | 88 | }); |
88 | 89 |
|
89 | 90 | it('should convert to hex when decimal', () => { |
90 | | - const hexBalance = AccountParser.getHexBalance('500', Web3); |
| 91 | + const hexBalance = utils.getHexBalanceFromString('500', Web3); |
91 | 92 |
|
92 | 93 | assert.strictEqual(hexBalance, '0x1f4'); |
93 | 94 | }); |
94 | 95 |
|
95 | 96 | it('should convert to hex with eth string', () => { |
96 | | - const hexBalance = AccountParser.getHexBalance('4ether', Web3); |
| 97 | + const hexBalance = utils.getHexBalanceFromString('4ether', Web3); |
97 | 98 |
|
98 | 99 | assert.strictEqual(hexBalance, '0x3782dace9d900000'); |
99 | 100 | }); |
100 | 101 |
|
101 | 102 | it('should convert to hex with eth string with space', () => { |
102 | | - const hexBalance = AccountParser.getHexBalance('673 shannon', Web3); |
| 103 | + const hexBalance = utils.getHexBalanceFromString('673 shannon', Web3); |
103 | 104 |
|
104 | 105 | assert.strictEqual(hexBalance, '0x9cb1ed0a00'); |
105 | 106 | }); |
106 | 107 |
|
107 | 108 | it('should fail when string is not good', () => { |
108 | 109 | try { |
109 | | - AccountParser.getHexBalance('nogood', Web3); |
| 110 | + utils.getHexBalanceFromString('nogood', Web3); |
110 | 111 | assert.fail('Should have failed at getHexBalance'); |
111 | 112 | } catch (e) { |
112 | 113 | // Ok |
|
0 commit comments