test: update HistoryView delete task test to handle confirmation dialog

This commit is contained in:
EMSHVAC 2025-02-24 11:54:10 -06:00
parent fc660a52e5
commit 1922b8aea9

View file

@ -135,7 +135,7 @@ describe("HistoryView", () => {
})
})
it("handles task deletion", () => {
it("handles task deletion", async () => {
const onDone = jest.fn()
render(<HistoryView onDone={onDone} />)
@ -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",