web3.js/test/web3.eth.iban.js
Fabian Vogelsteller bbfefb091c Modularize web3.js (#541)
* 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
2017-01-26 10:24:14 +01:00

47 lines
1.5 KiB
JavaScript

var chai = require('chai');
var assert = chai.assert;
var Eth = require('../packages/web3-eth');
var eth = new Eth();
var tests = [
{
direct: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS',
address: '0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8' // checksum address
},
{
direct: 'XE1222Q908LN1QBBU6XUQSO1OHWJIOS46OO',
address: '0x11c5496AEE77c1bA1f0854206a26dDa82A81D6D8'
},
{
direct: 'XE75JRZCTTLBSYEQBGAS7GID8DKR7QY0QA3',
address: '0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B' // checksum address
},
{
error: true,
direct: 'XE81ETHXREGGAVOFYORK',
address: '0xHELLO' // checksum address
}
];
describe('eth', function () {
describe('iban', function () {
tests.forEach(function (test) {
it('toAddress() should transform iban to address: ' + test.address, function () {
if(test.error) {
assert.throws(eth.iban.toAddress.bind(eth, test.direct));
} else {
assert.deepEqual(eth.iban.toAddress(test.direct), test.address);
}
});
it('toIBAN() should transform address to iban: ' + test.address, function () {
if(test.error) {
assert.throws(eth.iban.toIBAN.bind(eth, test.address));
} else {
assert.deepEqual(eth.iban.toIBAN(test.address), test.direct);
}
});
});
});
});