@@ -289,6 +289,22 @@ contract("Streaming Payments", (accounts) => {
289289 expect ( balancePost . sub ( balancePre ) ) . to . eq . BN ( WAD . muln ( 2 ) . subn ( 1 ) ) ; // -1 for network fee
290290 } ) ;
291291
292+ it ( `can claim a streaming payment correctly where the streaming payment id is not the same as the domain id
293+ or is a domain id that doesn't exist` , async ( ) => {
294+ await fundColonyWithTokens ( colony , token , WAD . muln ( 10 ) ) ;
295+
296+ await streamingPayments . create ( 1 , UINT256_MAX , 1 , UINT256_MAX , 1 , 0 , UINT256_MAX , SECONDS_PER_DAY , USER1 , [ token . address ] , [ WAD ] ) ;
297+ const tx = await streamingPayments . create ( 1 , UINT256_MAX , 1 , UINT256_MAX , 1 , 0 , UINT256_MAX , SECONDS_PER_DAY , USER1 , [ token . address ] , [ WAD ] ) ;
298+ const blockTime = await getBlockTime ( tx . receipt . blockNumber ) ;
299+ const streamingPaymentId = await streamingPayments . getNumStreamingPayments ( ) ;
300+
301+ const balancePre = await token . balanceOf ( USER1 ) ;
302+ const claimArgs = [ 1 , UINT256_MAX , UINT256_MAX , UINT256_MAX , streamingPaymentId , [ token . address ] ] ;
303+ await makeTxAtTimestamp ( streamingPayments . claim , claimArgs , blockTime + SECONDS_PER_DAY * 2 , this ) ;
304+ const balancePost = await token . balanceOf ( USER1 ) ;
305+ expect ( balancePost . sub ( balancePre ) ) . to . eq . BN ( WAD . muln ( 2 ) . subn ( 1 ) ) ; // -1 for network fee
306+ } ) ;
307+
292308 it ( "cannot get more from a payment than should be able to" , async ( ) => {
293309 await fundColonyWithTokens ( colony , token , WAD . muln ( 1 ) ) ;
294310
0 commit comments