From 1922b8aea9eea349144bc820d5f3c170530c3dfe Mon Sep 17 00:00:00 2001 From: EMSHVAC Date: Mon, 24 Feb 2025 11:54:10 -0600 Subject: [PATCH] test: update HistoryView delete task test to handle confirmation dialog --- .../src/components/history/__tests__/HistoryView.test.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/history/__tests__/HistoryView.test.tsx b/webview-ui/src/components/history/__tests__/HistoryView.test.tsx index 7408b26878..12b0181af6 100644 --- a/webview-ui/src/components/history/__tests__/HistoryView.test.tsx +++ b/webview-ui/src/components/history/__tests__/HistoryView.test.tsx @@ -135,7 +135,7 @@ describe("HistoryView", () => { }) }) - it("handles task deletion", () => { + it("handles task deletion", async () => { const onDone = jest.fn() render() @@ -143,9 +143,14 @@ describe("HistoryView", () => { const taskContainer = screen.getByTestId("virtuoso-item-1") fireEvent.mouseEnter(taskContainer) + // Click delete button to open confirmation dialog const deleteButton = within(taskContainer).getByTitle("Delete Task") fireEvent.click(deleteButton) + // Find and click the confirm delete button in the dialog + const confirmDeleteButton = screen.getByRole("button", { name: /delete/i }) + fireEvent.click(confirmDeleteButton) + // Verify vscode message was sent expect(vscode.postMessage).toHaveBeenCalledWith({ type: "deleteTaskWithId",