@@ -14,7 +14,7 @@ let initialEtherBalance = new BN(10);
1414let etherWithdrawAmt = new BN ( 3 ) ;
1515
1616const { zeroBN} = require ( "../helper.js" ) ;
17- const { expectRevert } = require ( '@openzeppelin/test-helpers' ) ;
17+ const { expectRevert, expectEvent } = require ( '@openzeppelin/test-helpers' ) ;
1818
1919contract ( 'WithdrawableNoModifiers' , function ( accounts ) {
2020 before ( "should init globals, deploy test token" , async function ( ) {
@@ -37,7 +37,12 @@ contract('WithdrawableNoModifiers', function(accounts) {
3737 Helper . assertEqual ( admin , rxAdmin , "wrong admin " + rxAdmin . toString ( ) ) ;
3838
3939 // withdraw the tokens from withdrawableInst
40- await withdrawableInst . withdrawToken ( token . address , tokenWithdrawAmt , user , { from : admin } ) ;
40+ let txResult = await withdrawableInst . withdrawToken ( token . address , tokenWithdrawAmt , user , { from : admin } ) ;
41+ expectEvent ( txResult , "TokenWithdraw" , {
42+ token : token . address ,
43+ amount : tokenWithdrawAmt ,
44+ sendTo : user ,
45+ } )
4146
4247 balance = await token . balanceOf ( withdrawableInst . address ) ;
4348 Helper . assertEqual ( balance , initialTokenBalance . sub ( tokenWithdrawAmt ) , "unexpected balance in withdrawble contract." ) ;
@@ -76,8 +81,11 @@ contract('WithdrawableNoModifiers', function(accounts) {
7681
7782 it ( "should test withdraw ether success for admin." , async function ( ) {
7883 // withdraw the ether from withdrawableInst
79- await withdrawableInst . withdrawEther ( etherWithdrawAmt , user , { from : admin } ) ;
80-
84+ let txResult = await withdrawableInst . withdrawEther ( etherWithdrawAmt , user , { from : admin } ) ;
85+ expectEvent ( txResult , "EtherWithdraw" , {
86+ amount : etherWithdrawAmt ,
87+ sendTo : user ,
88+ } )
8189 let balance = await Helper . getBalancePromise ( withdrawableInst . address ) ;
8290 Helper . assertEqual ( balance , initialEtherBalance . sub ( etherWithdrawAmt ) , "unexpected balance in withdrawble contract." ) ;
8391 } ) ;
0 commit comments