11import { beforeAll , describe , expect , it } from 'vitest' ;
22import { ALICE , BOB , CHARLIE , deployPsp22Contract , psp22Metadata , wrapper } from '../utils' ;
33import { numberToHex } from 'dedot/utils' ;
4- import { renderHook , waitFor } from '@testing-library/react' ;
4+ import { render , renderHook , waitFor } from '@testing-library/react' ;
55import { useContractQuery , useContractTx , useRawContract } from 'typink' ;
66import { Contract } from 'dedot/contracts' ;
77import { Psp22ContractApi } from 'contracts/psp22' ;
8+ import { AccountId32 } from 'dedot/codecs' ;
89
910describe ( 'useContractQuery' , ( ) => {
1011 let contractAddress : string , contract : Contract < Psp22ContractApi > ;
@@ -29,23 +30,16 @@ describe('useContractQuery', () => {
2930 expect ( totalSupply . current . isLoading ) . toEqual ( false ) ;
3031 } ) ;
3132
32- totalSupply . current . refresh ( ) ;
33-
34- await waitFor ( ( ) => {
35- expect ( totalSupply . current . isRefreshing ) . toEqual ( true ) ;
36- } ) ;
37-
38- await waitFor ( ( ) => {
39- expect ( totalSupply . current . data ) . toEqual ( BigInt ( 1e20 ) ) ;
40- expect ( totalSupply . current . isRefreshing ) . toEqual ( false ) ;
41- } ) ;
42-
4333 const { result : balanceOf } = renderHook (
44- ( ) => useContractQuery ( { contract, args : [ '0x_FAKE_' ] , fn : 'psp22BalanceOf' } ) ,
34+ ( { address } ) => useContractQuery ( { contract, args : [ address ] , fn : 'psp22BalanceOf' } ) ,
4535 {
4636 wrapper,
37+ initialProps : {
38+ address : '0x__FAKE' ,
39+ } ,
4740 } ,
4841 ) ;
42+
4943 await waitFor ( ( ) => {
5044 expect ( balanceOf . current . error ) . toBeDefined ( ) ;
5145 } ) ;
0 commit comments