mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-24 12:08:22 +00:00
16 lines
629 B
JavaScript
16 lines
629 B
JavaScript
var assert = require('assert');
|
|
var utils = require('../lib/utils.js');
|
|
|
|
describe('utils', function () {
|
|
describe('toHex', function () {
|
|
it('should return the correct value', function () {
|
|
|
|
assert.equal(utils.toHex(1000), "0x3e8");
|
|
assert.equal(utils.toHex('1000'), "0x3e8");
|
|
assert.equal(utils.toHex('hello'), "0x68656c6c6f");
|
|
assert.equal(utils.toHex({test: 'test'}), "0x7b2274657374223a2274657374227d");
|
|
assert.equal(utils.toHex([1,2,3,{hallo:'test'}]), '0x5b312c322c332c7b2268616c6c6f223a2274657374227d5d');
|
|
|
|
});
|
|
});
|
|
}); |