Skip to content

fix(tests): stub listTasks in the PROJECT_DELETE handler test - #857

Merged
h4yfans merged 1 commit into
mainfrom
tasks-handlers-cascade-mock
Jul 22, 2026
Merged

fix(tests): stub listTasks in the PROJECT_DELETE handler test#857
h4yfans merged 1 commit into
mainfrom
tasks-handlers-cascade-mock

Conversation

@h4yfans

@h4yfans h4yfans commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Main's Unit & integration tests job has been red since #854 merged. One failure:

FAIL src/main/ipc/tasks-handlers.test.ts > tasks-handlers > Project operations
     > PROJECT_DELETE handler > should delete a project
AssertionError: expected false to be true

Cause

#854 (issue #837) made deleteProject enumerate the project's tasks so each cascaded task gets its own tombstone:

const cascadedTasks = repository.listTasks({ projectId: id, includeCompleted: true, includeArchived: true })
repository.deleteProject(id)
await publisher.projectDeleted({ id, snapshot })
for (const task of cascadedTasks) { ... }

tasks-handlers.test.ts declares listTasks: vi.fn() but the PROJECT_DELETE case never stubbed a return value, so the command iterated undefined, threw, and the handler returned { success: false }.

Confirmed by checking out f6a7b1234 (the #854 merge itself, before anything else landed) and running the file — it fails there. Not a flake: it failed twice on CI, including a clean re-run.

Fix

Stub listTasks in that test, plus a second case pinning the enumeration contract — completed and archived tasks cascade too, so they must be in the listing. The domain-level cascade behaviour itself stays covered by packages/domain-tasks/src/commands-delete-project.test.ts from #854.

Verification

  • src/main/ipc project suite: 501 passed (was 500 passed / 1 failed)
  • eslint, prettier, ipc:check (pre-commit): clean

🤖 Generated with Claude Code

#854 made deleteProject enumerate the project's tasks so each cascaded task
gets its own tombstone. The IPC handler test never stubbed `listTasks`, so
the command iterated `undefined`, threw, and returned `success: false` —
main's "Unit & integration tests" job has been red since that merge.

Stub it, and add a second case that pins the enumeration contract: completed
and archived tasks cascade too, so they must be included in the listing.
Copilot AI review requested due to automatic review settings July 22, 2026 16:38
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
memry-docs Ignored Ignored Preview Jul 22, 2026 4:39pm
memrynote-landing Ignored Ignored Jul 22, 2026 4:39pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added bug Something isn't working test labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 5c63088.

@h4yfans
h4yfans marked this pull request as ready for review July 22, 2026 17:01
@h4yfans
h4yfans merged commit a8a782e into main Jul 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants