test(dashboard): stabilize MailboxView unread-badge assertion
The badge only appears after fetchAgentMailbox resolves, so asserting immediately after the subtabs render raced against the async update. Move the badge check inside waitFor so it polls until populated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -974,12 +974,9 @@ describe("MailboxView", () => {
|
||||
fireEvent.change(screen.getByTestId("mailbox-agent-select"), { target: { value: "agent-001" } });
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId("mailbox-agent-subtabs")).toBeDefined();
|
||||
const inboxTab = screen.getByTestId("mailbox-agent-subtab-inbox");
|
||||
expect(inboxTab.querySelector(".mailbox-tab-badge")?.textContent).toBe("3");
|
||||
});
|
||||
|
||||
// Inbox tab should have the unread badge
|
||||
const inboxTab = screen.getByTestId("mailbox-agent-subtab-inbox");
|
||||
expect(inboxTab.querySelector(".mailbox-tab-badge")?.textContent).toBe("3");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user