Skip to content

Commit b413e3e

Browse files
committed
test: fix test
1 parent e060f61 commit b413e3e

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

packages/shared/src/components/profile/ProfileButton.spec.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { QueryClient } from '@tanstack/react-query';
33
import type { RenderResult } from '@testing-library/react';
4-
import { waitFor, render, screen } from '@testing-library/react';
4+
import { waitFor, render, screen, act } from '@testing-library/react';
55
import ProfileButton from './ProfileButton';
66
import defaultUser from '../../../__tests__/fixture/loggedUser';
77
import { TestBootProvider } from '../../../__tests__/helpers/boot';
@@ -32,21 +32,27 @@ const renderComponent = (): RenderResult => {
3232
);
3333
};
3434

35-
it('account details should link to account profile page', async () => {
35+
it('should show settings option that opens modal', async () => {
3636
renderComponent();
3737

3838
const profileBtn = await screen.findByLabelText('Profile settings');
39-
profileBtn.click();
40-
41-
const accountLink = await screen.findByRole('link', { name: 'Settings' });
42-
expect(accountLink).toHaveAttribute('href', '/account/profile');
39+
await act(async () => {
40+
profileBtn.click();
41+
});
42+
43+
const settingsButton = await screen.findByRole('button', {
44+
name: 'Settings',
45+
});
46+
expect(settingsButton).toBeInTheDocument();
4347
});
4448

4549
it('should click the logout button and logout', async () => {
4650
renderComponent();
4751

4852
const profileBtn = await screen.findByLabelText('Profile settings');
49-
profileBtn.click();
53+
await act(async () => {
54+
profileBtn.click();
55+
});
5056

5157
const logoutBtn = await screen.findByText('Logout');
5258
logoutBtn.click();

0 commit comments

Comments
 (0)