web3.js/test/utils.toUtf8.js

21 lines
587 B
JavaScript

var chai = require('chai');
var BigNumber = require('bignumber.js');
var web3 = require('../index');
var assert = chai.assert;
var tests = [
{ value: '0x6d79537472696e67', expected: 'myString'},
{ value: '0x6d79537472696e6700', expected: 'myString\x00'},
];
describe('lib/utils/utils', function () {
describe('toUtf8', function () {
tests.forEach(function (test) {
it('should turn ' + test.value + ' to ' + test.expected, function () {
assert.strictEqual(web3.toUtf8(test.value), test.expected);
});
});
});
});