From c068940572fe8ab16f179466cdcb6eee9f399fc7 Mon Sep 17 00:00:00 2001 From: sudiptab2100 <41054678+sudiptab2100@users.noreply.github.com> Date: Sun, 14 Mar 2021 16:05:41 +0530 Subject: [PATCH] Fix for DappToken.js " error.message " => " error.toString() " --- test/DappToken.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/DappToken.js b/test/DappToken.js index ff3061d13..1d0b19d97 100644 --- a/test/DappToken.js +++ b/test/DappToken.js @@ -34,9 +34,9 @@ contract('DappToken', function(accounts) { return DappToken.deployed().then(function(instance) { tokenInstance = instance; // Test `require` statement first by transferring something larger than the sender's balance - return tokenInstance.transfer.call(accounts[1], 99999999999999999999999); + return tokenInstance.transfer.call(accounts[1], 9999999999999); }).then(assert.fail).catch(function(error) { - assert(error.message.indexOf('revert') >= 0, 'error message must contain revert'); + assert(error.toString().indexOf('revert') >= 0, 'error message must contain revert'); return tokenInstance.transfer.call(accounts[1], 250000, { from: accounts[0] }); }).then(function(success) { assert.equal(success, true, 'it returns true'); @@ -90,11 +90,11 @@ contract('DappToken', function(accounts) { // Try transferring something larger than the sender's balance return tokenInstance.transferFrom(fromAccount, toAccount, 9999, { from: spendingAccount }); }).then(assert.fail).catch(function(error) { - assert(error.message.indexOf('revert') >= 0, 'cannot transfer value larger than balance'); + assert(error.toString().indexOf('revert') >= 0, 'cannot transfer value larger than balance'); // Try transferring something larger than the approved amount return tokenInstance.transferFrom(fromAccount, toAccount, 20, { from: spendingAccount }); }).then(assert.fail).catch(function(error) { - assert(error.message.indexOf('revert') >= 0, 'cannot transfer value larger than approved amount'); + assert(error.toString().indexOf('revert') >= 0, 'cannot transfer value larger than approved amount'); return tokenInstance.transferFrom.call(fromAccount, toAccount, 10, { from: spendingAccount }); }).then(function(success) { assert.equal(success, true);