@@ -5,7 +5,10 @@ import { MockedCryptoClient } from "../helpers";
55import { ShielderClient } from "../../src/client/client" ;
66import { createShielderClient } from "../../src/client/factories" ;
77import { Contract } from "../../src/chain/contract" ;
8- import { quotedFeesFromExpectedTokenFee , Relayer } from "../../src/chain/relayer" ;
8+ import {
9+ quotedFeesFromExpectedTokenFee ,
10+ Relayer
11+ } from "../../src/chain/relayer" ;
912import { InjectedStorageInterface } from "../../src/storage/storageSchema" ;
1013import {
1114 AccountStateMerkleIndexed ,
@@ -89,7 +92,9 @@ describe("ShielderClient", () => {
8992 callbacks = {
9093 onCalldataGenerated : vitest . fn ( ) ,
9194 onCalldataSent : vitest . fn ( ) ,
92- onError : vitest . fn ( )
95+ onError : vitest . fn ( ) ,
96+ onSdkOutdated : vitest . fn ( ) ,
97+ onAccountNotOnChain : vitest . fn ( )
9398 } ;
9499
95100 // Create client instance with mocked components
@@ -141,7 +146,11 @@ describe("ShielderClient", () => {
141146 contractAddress : mockContractAddress ,
142147 relayerUrl : mockRelayerUrl ,
143148 storage : mockStorageInterface ,
144- cryptoClient : mockCryptoClient
149+ cryptoClient : mockCryptoClient ,
150+ callbacks : {
151+ onSdkOutdated : vitest . fn ( ) ,
152+ onAccountNotOnChain : vitest . fn ( )
153+ }
145154 } ) ;
146155 } ) ;
147156
@@ -157,15 +166,20 @@ describe("ShielderClient", () => {
157166 it ( "should create ShielderClient with default callbacks" , ( ) => {
158167 expect ( client ) . toBeInstanceOf ( ShielderClient ) ;
159168 // Verify that the client was created with empty callbacks object
160- expect ( client [ "callbacks" ] ) . toEqual ( { } ) ;
169+ expect ( client [ "callbacks" ] ) . toEqual ( {
170+ onSdkOutdated : expect . any ( Function ) ,
171+ onAccountNotOnChain : expect . any ( Function )
172+ } ) ;
161173 } ) ;
162174
163175 it ( "should create ShielderClient with provided callbacks" , ( ) => {
164176 const mockCallbacks = {
165177 onCalldataGenerated : vitest . fn ( ) ,
166178 onCalldataSent : vitest . fn ( ) ,
167179 onNewTransaction : vitest . fn ( ) ,
168- onError : vitest . fn ( )
180+ onError : vitest . fn ( ) ,
181+ onAccountNotOnChain : vitest . fn ( ) ,
182+ onSdkOutdated : vitest . fn ( )
169183 } ;
170184
171185 client = createShielderClient ( {
@@ -209,7 +223,7 @@ describe("ShielderClient", () => {
209223 mockStateSynchronizer . syncAllAccounts . mockRejectedValue ( mockError ) ;
210224
211225 await expect ( client . syncShielder ( ) ) . rejects . toThrow ( mockError ) ;
212- expect ( callbacks . onError ) . toHaveBeenCalledWith (
226+ expect ( callbacks . onSdkOutdated ) . toHaveBeenCalledWith (
213227 mockError ,
214228 "syncing" ,
215229 "sync"
0 commit comments