From fb204b7afdb4b5fb09531738c3e12e3d4f6cf9cd Mon Sep 17 00:00:00 2001 From: Jesse Snyder Date: Tue, 26 Nov 2024 13:56:01 -0600 Subject: [PATCH] fix tests --- .../AstriaWithdrawerService.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/features/EthWallet/services/AstriaWithdrawerService/AstriaWithdrawerService.test.ts b/web/src/features/EthWallet/services/AstriaWithdrawerService/AstriaWithdrawerService.test.ts index a8ba85c..9546237 100644 --- a/web/src/features/EthWallet/services/AstriaWithdrawerService/AstriaWithdrawerService.test.ts +++ b/web/src/features/EthWallet/services/AstriaWithdrawerService/AstriaWithdrawerService.test.ts @@ -25,13 +25,11 @@ describe("AstriaWithdrawerService and AstriaErc20WithdrawerService", () => { const mockTxHash = "0xabcdef0123456789" as const; const mockWalletClient = { - writeContract: jest - .fn() - .mockImplementation(() => Promise.resolve(mockTxHash)), + writeContract: jest.fn().mockReturnValue(Promise.resolve(mockTxHash)), }; const mockPublicClient = { - readContract: jest.fn().mockImplementation(() => Promise.resolve(1000000)), + readContract: jest.fn().mockReturnValue(Promise.resolve(1000000)), }; const mockWagmiConfig = { @@ -43,6 +41,10 @@ describe("AstriaWithdrawerService and AstriaErc20WithdrawerService", () => { beforeEach(() => { jest.resetAllMocks(); + + mockWalletClient.writeContract.mockReturnValue(Promise.resolve(mockTxHash)); + mockPublicClient.readContract.mockReturnValue(Promise.resolve(1000000)); + (getWalletClient as jest.Mock).mockResolvedValue(mockWalletClient); (getPublicClient as jest.Mock).mockReturnValue(mockPublicClient); });