Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer committed Mar 6, 2025
1 parent e476129 commit 02122f9
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/identity/hooks/useAvatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,15 @@ describe('useAvatar', () => {
const testEnsName = 'test.ens';
const testEnsAvatar = 'avatarUrl';

// Mock the getEnsAvatar method of the publicClient
mockGetEnsAvatar.mockResolvedValue(testEnsAvatar);

// Use the renderHook function to create a test harness for the useAvatar hook with enabled: false
const { result } = renderHook(
() => useAvatar({ ensName: testEnsName }, { enabled: false }),
{
wrapper: getNewReactQueryTestProvider(),
},
);

// The query should not be executed
expect(result.current.isLoading).toBe(false);
expect(result.current.isFetched).toBe(false);
expect(mockGetEnsAvatar).not.toHaveBeenCalled();
Expand All @@ -160,43 +157,35 @@ describe('useAvatar', () => {
const testEnsName = 'test.ens';
const testEnsAvatar = 'avatarUrl';

// Mock the getEnsAvatar method of the publicClient
mockGetEnsAvatar.mockResolvedValue(testEnsAvatar);

// Use the renderHook function to create a test harness for the useAvatar hook
renderHook(() => useAvatar({ ensName: testEnsName }), {
wrapper: getNewReactQueryTestProvider(),
});

// Wait for the hook to finish fetching the ENS avatar
await waitFor(() => {
// Check that the default query options were used
expect(mockGetEnsAvatar).toHaveBeenCalled();
});
});

it('merges custom queryOptions with default options', async () => {
const testEnsName = 'test.ens';
const testEnsAvatar = 'avatarUrl';
const customStaleTime = 60000; // 1 minute
const customStaleTime = 60000;

// Mock the getEnsAvatar method of the publicClient
mockGetEnsAvatar.mockResolvedValue(testEnsAvatar);

// Use the renderHook function to create a test harness for the useAvatar hook with custom staleTime
const { result } = renderHook(
() => useAvatar({ ensName: testEnsName }, { staleTime: customStaleTime }),
{
wrapper: getNewReactQueryTestProvider(),
},
);

// Wait for the hook to finish fetching the ENS avatar
await waitFor(() => {
expect(result.current.data).toBe(testEnsAvatar);
});

// The query should be executed with the custom staleTime
expect(mockGetEnsAvatar).toHaveBeenCalled();
});
});

0 comments on commit 02122f9

Please sign in to comment.