test(webui): await lazy settings import deterministically

This commit is contained in:
chengyongru
2026-08-11 13:59:22 +08:00
committed by chengyongru
parent eab017766b
commit cac39477ba
+5 -1
View File
@@ -441,8 +441,12 @@ describe("App layout", () => {
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
fireEvent.click(within(sidebar).getByRole("button", { name: "Settings" }));
await act(async () => {
await import("@/components/settings/SettingsView");
});
expect(
await screen.findByRole("navigation", { name: "Settings sections" }),
screen.getByRole("navigation", { name: "Settings sections" }),
).toBeInTheDocument();
expect(container.querySelectorAll("main")).toHaveLength(1);
expect(screen.getByRole("heading", { level: 1, name: "Settings" })).toBeInTheDocument();