From d26902bcb7a44dbbed2870a91176998ded77d773 Mon Sep 17 00:00:00 2001 From: Paul Cramer Date: Mon, 10 Mar 2025 15:54:20 -0700 Subject: [PATCH] liting --- src/identity/hooks/useAvatars.test.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/identity/hooks/useAvatars.test.tsx b/src/identity/hooks/useAvatars.test.tsx index 46eff771c5..deefc676ee 100644 --- a/src/identity/hooks/useAvatars.test.tsx +++ b/src/identity/hooks/useAvatars.test.tsx @@ -1,6 +1,5 @@ import { publicClient } from '@/core/network/client'; import { getChainPublicClient } from '@/core/network/getChainPublicClient'; -import { getAvatars } from '@/identity/utils/getAvatars'; import { renderHook, waitFor } from '@testing-library/react'; import { base, baseSepolia, mainnet, optimism } from 'viem/chains'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -241,8 +240,10 @@ describe('useAvatars', () => { const testEnsNames = ['success1.eth', 'fail.eth', 'success2.eth']; const partialResults = ['avatar1-url', null, 'avatar2-url']; - const mockGetAvatars = vi.spyOn({ getAvatars }, 'getAvatars'); - mockGetAvatars.mockResolvedValue(partialResults); + mockGetEnsAvatar + .mockResolvedValueOnce('avatar1-url') + .mockRejectedValueOnce(new Error('Failed to resolve avatar')) + .mockResolvedValueOnce('avatar2-url'); const { result } = renderHook( () => useAvatars({ ensNames: testEnsNames }), @@ -257,11 +258,6 @@ describe('useAvatars', () => { expect(result.current.isError).toBe(false); }); - expect(mockGetAvatars).toHaveBeenCalledWith({ - ensNames: testEnsNames, - chain: mainnet, - }); - - mockGetAvatars.mockRestore(); + expect(getChainPublicClient).toHaveBeenCalledWith(mainnet); }); });