|
1 |
| -import { render, screen, waitFor } from "@testing-library/react"; |
| 1 | +import { render, screen } from "@testing-library/react"; |
2 | 2 | import "@testing-library/jest-dom";
|
3 | 3 | import { AppHeader } from "../AppHeader";
|
4 |
| -import userEvent from "@testing-library/user-event"; |
5 | 4 | import { BrowserRouter } from 'react-router-dom';
|
6 |
| -import { act } from 'react'; |
7 | 5 |
|
8 | 6 | describe("AppHeader", () => {
|
9 | 7 | // Store the original 'location' object so that it can be restored for other tests.
|
@@ -33,30 +31,5 @@ describe("AppHeader", () => {
|
33 | 31 |
|
34 | 32 | // Check "Logout" option is not present
|
35 | 33 | expect(screen.queryByText("Logout")).toBeNull();
|
36 |
| - // const accountMenuToggle = await act(()=> { |
37 |
| - // screen.findByTestId( |
38 |
| - // "page-masthead-dropdown__button", |
39 |
| - // ); |
40 |
| - // }); |
41 |
| - const accountMenuToggle = await screen.findByTestId( |
42 |
| - "page-masthead-dropdown__button", |
43 |
| - ); |
44 |
| - // await act(() => { |
45 |
| - // userEvent.click(accountMenuToggle); |
46 |
| - // }); |
47 |
| - // await userEvent.click(accountMenuToggle); |
48 |
| - // "Logout" menu option should now be present |
49 |
| - // expect(await screen.findByText("Logout")).toBeInTheDocument(); |
50 |
| - |
51 |
| - // Emulate clicking on the logout button |
52 |
| - // const logoutMenuItem = await act(() => { |
53 |
| - // screen.findByTestId("app-header__logout"); |
54 |
| - // }); |
55 |
| - const logoutMenuItem = screen.findByTestId("app-header__logout"); |
56 |
| - // await act(() => { |
57 |
| - // userEvent.click(logoutMenuItem); |
58 |
| - // }); |
59 |
| - // await userEvent.click(logoutMenuItem); |
60 |
| - // expect(window.location.assign).toHaveBeenCalledWith("/logout"); |
61 | 34 | });
|
62 | 35 | });
|
0 commit comments