mirror of
https://github.com/embarklabs/web3.js.git
synced 2026-08-31 14:41:17 +00:00
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
var chai = require('chai');
|
|
var assert = chai.assert;
|
|
var Web3 = require('../src/index.js');
|
|
var web3 = new Web3();
|
|
|
|
var tests = [{
|
|
params: [['uint256','string'], ['2345675643', 'Hello!%']],
|
|
result: '0x000000000000000000000000000000000000000000000000000000008bd02b7b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000748656c6c6f212500000000000000000000000000000000000000000000000000'
|
|
},{
|
|
params: [['uint8[]','bytes32'], [['34','434'], '0x324567fff']],
|
|
result: '0x0000000000000000000000000000000000000000000000000000000000000040324567fff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000001b2'
|
|
}];
|
|
|
|
describe('encodeParameters', function () {
|
|
tests.forEach(function (test) {
|
|
it('should convert correctly', function () {
|
|
assert.equal(web3.eth.abi.encodeParameters.apply(web3.eth.abi, test.params), test.result);
|
|
});
|
|
});
|
|
});
|