Skip to content

Commit

Permalink
waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lee authored and John Lee committed Mar 7, 2024
1 parent 446ed6f commit 0e632d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/src/tests/Userprofile.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAuth0 } from '@auth0/auth0-react';
import { render } from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';

Expand All @@ -23,7 +23,7 @@ describe('UserProfile', () => {
useUserPlantedQuery.mockClear();
useUserTreeHistoryQuery.mockClear();
});
it('renders UserProfile correctly', () => {
it('renders UserProfile correctly', async () => {
useAuth0.mockReturnValue({
user: { nickname: 'testUser', email: '[email protected]' },
});
Expand All @@ -38,6 +38,8 @@ describe('UserProfile', () => {
<Userprofile />
</MemoryRouter>,
);
expect(userProfile).toMatchSnapshot();
await waitFor(() => {
expect(userProfile).toMatchSnapshot();
})
});
});

0 comments on commit 0e632d0

Please sign in to comment.