Skip to content

πŸ™Œ OpenHands: AI-Driven Development

test(settings): wait for the delete toast and close in DeleteProfileModal test (#18079)

Engel Nyst3b5304fcd22e
diff --git a/__tests__/components/settings/llm-profiles/delete-profile-modal.test.tsx b/__tests__/components/settings/llm-profiles/delete-profile-modal.test.tsx
index c200b56842..c34bfab033 100644
--- a/__tests__/components/settings/llm-profiles/delete-profile-modal.test.tsx
+++ b/__tests__/components/settings/llm-profiles/delete-profile-modal.test.tsx
@@ -124,16 +124,17 @@ describe("DeleteProfileModal", () => {
await user.click(screen.getByTestId("delete-profile-confirm"));
+ // The toast and close run after the mutation's async onSuccess, which
+ // settles later than the deleteProfile call itself.
await waitFor(() => {
expect(ProfilesService.deleteProfile).toHaveBeenCalledWith(
"profile-to-delete",
);
+ expect(toastHandlers.displaySuccessToast).toHaveBeenCalledWith(
+ 'Profile "profile-to-delete" deleted',
+ );
+ expect(handleClose).toHaveBeenCalled();
});
-
- expect(toastHandlers.displaySuccessToast).toHaveBeenCalledWith(
- 'Profile "profile-to-delete" deleted',
- );
- expect(handleClose).toHaveBeenCalled();
});
it("shows error toast on delete failure", async () => {