fix all failing karma tests

This commit is contained in:
Marek Kotewicz 2015-03-07 17:53:06 +01:00
parent 1fd1a315bb
commit 3f631094af
5 changed files with 15 additions and 17 deletions

11
dist/ethereum.js vendored
View File

@ -1110,18 +1110,17 @@ Formats the input of a transaction and converts all values to HEX
var inputTransactionFormatter = function(options){
// make code -> data
if(options.code) {
if (options.code) {
options.data = options.code;
delete options.code;
}
// make endowment -> value
if(options.endowment) {
if (options.endowment) {
options.value = options.endowment;
delete options.endowment;
}
// format the following options
/*jshint maxcomplexity:5 */
['gasPrice', 'gas', 'value'].forEach(function(key){
@ -1130,15 +1129,15 @@ var inputTransactionFormatter = function(options){
if(typeof options[key] === 'string') {
// if not hex assume its a number string
if(options[key].indexOf('0x') === -1)
if (options[key].indexOf('0x') === -1)
options[key] = utils.fromDecimal(options[key]);
// if number
} else if(typeof options[key] === 'number') {
} else if (typeof options[key] === 'number') {
options[key] = utils.fromDecimal(options[key]);
// if bignumber
} else if(options[key] instanceof BigNumber) {
} else if (utils.isBigNumber(options[key])) {
options[key] = '0x'+ options[key].toString(16);
}
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -166,18 +166,17 @@ Formats the input of a transaction and converts all values to HEX
var inputTransactionFormatter = function(options){
// make code -> data
if(options.code) {
if (options.code) {
options.data = options.code;
delete options.code;
}
// make endowment -> value
if(options.endowment) {
if (options.endowment) {
options.value = options.endowment;
delete options.endowment;
}
// format the following options
/*jshint maxcomplexity:5 */
['gasPrice', 'gas', 'value'].forEach(function(key){
@ -186,15 +185,15 @@ var inputTransactionFormatter = function(options){
if(typeof options[key] === 'string') {
// if not hex assume its a number string
if(options[key].indexOf('0x') === -1)
if (options[key].indexOf('0x') === -1)
options[key] = utils.fromDecimal(options[key]);
// if number
} else if(typeof options[key] === 'number') {
} else if (typeof options[key] === 'number') {
options[key] = utils.fromDecimal(options[key]);
// if bignumber
} else if(options[key] instanceof BigNumber) {
} else if (utils.isBigNumber(options[key])) {
options[key] = '0x'+ options[key].toString(16);
}
});

View File

@ -6,8 +6,8 @@ describe('utils', function () {
describe('toBigNumber', function () {
it('should return the correct value', function () {
assert.equal(utils.toBigNumber(100000) instanceof BigNumber, true);
assert.equal(utils.isBigNumber(utils.toBigNumber(100000)), true);
assert.equal(utils.toBigNumber(100000).toString(10), '100000');
});
});
});
});