From 76373267dcf4a54c6e4d18ead66f45a2f7c60a46 Mon Sep 17 00:00:00 2001 From: Victor Santos Date: Mon, 7 Jul 2025 11:47:16 -0300 Subject: [PATCH] updated tests --- .../components/recall-wrapper.test.tsx | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/apps/web/modules/survey/components/question-form-input/components/recall-wrapper.test.tsx b/apps/web/modules/survey/components/question-form-input/components/recall-wrapper.test.tsx index 495b16e2e3..79404d0483 100644 --- a/apps/web/modules/survey/components/question-form-input/components/recall-wrapper.test.tsx +++ b/apps/web/modules/survey/components/question-form-input/components/recall-wrapper.test.tsx @@ -45,13 +45,15 @@ vi.mock("@/lib/utils/recall", async () => { global.structuredClone = global.structuredClone || ((obj: any) => JSON.parse(JSON.stringify(obj))); vi.mock("@/modules/survey/components/question-form-input/components/fallback-input", () => ({ - FallbackInput: vi.fn().mockImplementation(({ addFallback }) => ( -
- -
- )), + FallbackInput: vi.fn().mockImplementation(({ addFallback, open }) => + open ? ( +
+ +
+ ) : null + ), })); vi.mock("@/modules/survey/components/question-form-input/components/recall-item-select", () => ({ @@ -204,10 +206,22 @@ describe("RecallWrapper", () => { const editButton = screen.getByText("Edit Recall"); - // Test that clicking the button works (preventDefault should be called) + // Verify the edit button is functional and clickable + expect(editButton).toBeInTheDocument(); + expect(editButton).toBeEnabled(); + + // Click the "Edit Recall" button - this should work without errors await userEvent.click(editButton); - // Verify the button is still there and clickable + // The button should still be present and functional after clicking expect(editButton).toBeInTheDocument(); + expect(editButton).toBeEnabled(); + + // Click again to verify the button can be clicked multiple times + await userEvent.click(editButton); + + // Button should still be functional + expect(editButton).toBeInTheDocument(); + expect(editButton).toBeEnabled(); }); });