@@ -112,6 +112,10 @@ fn test_initialize_rejects_second_call() {
112112 let admin = Address :: generate ( & env) ;
113113 let treasury = Address :: generate ( & env) ;
114114
115+ assert_eq ! ( stream_id1, 1 ) ;
116+ assert_eq ! ( stream_id2, 2 ) ;
117+ assert ! ( client. get_stream( & stream_id1) . is_some( ) ) ;
118+ assert ! ( client. get_stream( & stream_id2) . is_some( ) ) ;
115119 client. initialize ( & admin, & treasury, & 100 ) ;
116120 let result = client. try_initialize ( & admin, & treasury, & 100 ) ;
117121 assert_eq ! ( result, Err ( Ok ( StreamError :: AlreadyInitialized ) ) ) ;
@@ -340,6 +344,10 @@ fn test_top_up_rejects_negative_amount() {
340344 let client = create_contract ( & env) ;
341345 let id = client. create_stream ( & sender, & Address :: generate ( & env) , & token, & 10_000 , & 100 ) ;
342346
347+ let contract_id = env. register ( StreamContract , ( ) ) ;
348+ let client = StreamContractClient :: new ( & env, & contract_id) ;
349+ let token_client = token:: Client :: new ( & env, & token_address) ;
350+ token_client. approve ( & sender, & contract_id, & 20_000 , & 1_000_000 ) ;
343351 assert_eq ! (
344352 client. try_top_up_stream( & sender, & id, & -50 ) ,
345353 Err ( Ok ( StreamError :: InvalidAmount ) )
@@ -514,6 +522,10 @@ fn test_withdraw_emits_event() {
514522 let client = create_contract ( & env) ;
515523 let id = client. create_stream ( & sender, & recipient, & token, & 500 , & 100 ) ;
516524
525+ let contract_id = env. register ( StreamContract , ( ) ) ;
526+ let client = StreamContractClient :: new ( & env, & contract_id) ;
527+ let token_client = token:: Client :: new ( & env, & token_address) ;
528+ token_client. approve ( & sender, & contract_id, & 20_000 , & 1_000_000 ) ;
517529 // Advance time by 100 seconds to allow full withdrawal (500 tokens / 100 seconds = 5 tokens/sec)
518530 env. ledger ( ) . with_mut ( |l| {
519531 l. timestamp += 100 ;
0 commit comments