mirror of
https://github.com/embarklabs/web3.js.git
synced 2026-08-31 14:41:17 +00:00
* remove duplicate line (#1086) (#1098) * Align text for unitMap (#1127) * fixing compiler errors (#1174) * Added web3j-scala to the list of Other Implementations (#1206) * Extends HttpProvider with custom http headers (#1228) * extend HttpProvider with custom http headers * reset formatting * reset formatting * reset formatting * fix null object * fix null object * Adds checksum isAddress() test cases (#1224) * fixed tests * build files
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
var chai = require('chai');
|
|
var utils = require('../lib/utils/utils.js');
|
|
var assert = chai.assert;
|
|
|
|
var tests = [
|
|
{ value: function () {}, is: false},
|
|
{ value: new Function(), is: false},
|
|
{ value: 'function', is: false},
|
|
{ value: {}, is: false},
|
|
{ value: '0xc6d9d2cd449a754c494264e1809c50e34d64562b', is: true },
|
|
{ value: 'c6d9d2cd449a754c494264e1809c50e34d64562b', is: true },
|
|
{ value: '0xE247A45c287191d435A8a5D72A7C8dc030451E9F', is: true },
|
|
{ value: '0xE247a45c287191d435A8a5D72A7C8dc030451E9F', is: false },
|
|
{ value: '0xe247a45c287191d435a8a5d72a7c8dc030451e9f', is: true },
|
|
{ value: '0XE247A45C287191D435A8A5D72A7C8DC030451E9F', is: false },
|
|
{ value: '0xE247A45C287191D435A8A5D72A7C8DC030451E9F', is: true }
|
|
];
|
|
|
|
describe('lib/utils/utils', function () {
|
|
describe('isAddress', function () {
|
|
tests.forEach(function (test) {
|
|
it('shoud test if value ' + test.value + ' is address: ' + test.is, function () {
|
|
assert.equal(utils.isAddress(test.value), test.is);
|
|
});
|
|
});
|
|
});
|
|
});
|