mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 19:48:13 +00:00
* added sub packages * added lerna monopackage management * check for package is instance * added method, subscription and utils package * moved almost all packages * moved all packages, no umbrella package yet * added extend to packages * made contract pass * made batch tests pass * expose providers * fixed test async * fixed test errors * fixed test event encode decode * fixed test formatter tests * fixed method tests * fixed method utils * fixed some eth methods * fixed some eth methods 2 * bumped version 0.18.3 to republish meteor package * fixed get* tests * fixed subscribe tests * added newBlockHeaders subscription * remove unpublished package from package.json * added sendTransaction test * fixed call test * moved files to done * changed extend * added iban tests * Fixed ALL tests * Fixed lint tests * Fixed contract tests * added method tests * added more method tests to test promiEvents extensively * added confirmation event * improved method confirmation checking
97 lines
2.7 KiB
JavaScript
97 lines
2.7 KiB
JavaScript
var chai = require('chai');
|
|
var assert = chai.assert;
|
|
var formatters = require('../packages/web3-core-helpers/src/formatters.js');
|
|
|
|
var tests = [{
|
|
input: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '100',
|
|
from: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', // checksum address
|
|
to: '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae',
|
|
nonce: 1000,
|
|
gas: 1000,
|
|
gasPrice: '1000'
|
|
},
|
|
result: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '0x64',
|
|
from: '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae',
|
|
to: '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae',
|
|
nonce: '0x3e8',
|
|
gas: '0x3e8',
|
|
gasPrice: '0x3e8'
|
|
}
|
|
},{
|
|
input: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '100',
|
|
from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe' // checksum address
|
|
},
|
|
result: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '0x64',
|
|
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
to: '0x11f4d0a3c12e86b4b5f39b213f7e19d048276dae'
|
|
}
|
|
},{
|
|
input: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '100',
|
|
from: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
to: '00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
gas: '1000',
|
|
gasPrice: '1000'
|
|
},
|
|
result: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '0x64',
|
|
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
gas: '0x3e8',
|
|
gasPrice: '0x3e8'
|
|
},
|
|
}, {
|
|
input: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '100',
|
|
from: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
|
to: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
|
gas: '1000',
|
|
gasPrice: '1000'
|
|
},
|
|
result: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '0x64',
|
|
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
to: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
gas: '0x3e8',
|
|
gasPrice: '0x3e8'
|
|
},
|
|
}, {
|
|
input: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '100',
|
|
from: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
|
|
gas: '1000',
|
|
gasPrice: '1000'
|
|
},
|
|
result: {
|
|
data: '0x34234bf23bf4234',
|
|
value: '0x64',
|
|
from: '0x00c5496aee77c1ba1f0854206a26dda82a81d6d8',
|
|
gas: '0x3e8',
|
|
gasPrice: '0x3e8'
|
|
}
|
|
}];
|
|
|
|
describe('formatters', function () {
|
|
describe('inputTransactionFormatter', function () {
|
|
tests.forEach(function(test){
|
|
it('should return the correct value', function () {
|
|
assert.deepEqual(formatters.inputTransactionFormatter(test.input), test.result);
|
|
});
|
|
});
|
|
});
|
|
});
|