Skip to content

Commit

Permalink
Merge branch '1.0' into issue/2266
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida authored Feb 27, 2019
2 parents 98e9ed5 + b88ab82 commit 91d925a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/web3-core-helpers/src/Formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const outputTransactionReceiptFormatter = (receipt) => {
receipt.contractAddress = Utils.toChecksumAddress(receipt.contractAddress);
}

if (typeof receipt.status !== 'undefined') {
if (typeof receipt.status !== 'undefined' && receipt.status !== null) {
receipt.status = Boolean(parseInt(receipt.status));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class TransactionReceiptValidator {
* @returns {Boolean}
*/
isValidReceiptStatus(receipt) {
return receipt.status === true || typeof receipt.status === 'undefined';
return receipt.status === true || typeof receipt.status === 'undefined' || receipt.status === null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('TransactionReceiptValidatorTest', () => {
expect(Utils.hexToNumber).toHaveBeenCalledWith(110);
});

it('calls validate and returns true with undefined status property', () => {
it('calls validate and returns true with status property set to undefined', () => {
delete receipt.status;

Utils.hexToNumber.mockReturnValueOnce(110);
Expand All @@ -53,6 +53,22 @@ describe('TransactionReceiptValidatorTest', () => {
expect(Utils.hexToNumber).toHaveBeenCalledWith(110);
});

it('calls validate and returns true with status property set to null', () => {
receipt.status = null;

Utils.hexToNumber.mockReturnValueOnce(110);

method.parameters = [
{
gas: 110
}
];

expect(transactionReceiptValidator.validate(receipt, method)).toEqual(true);

expect(Utils.hexToNumber).toHaveBeenCalledWith(110);
});

it('calls validate and returns error because of invalid gasUsage', () => {
Utils.hexToNumber.mockReturnValueOnce(100);

Expand Down

0 comments on commit 91d925a

Please sign in to comment.