Skip to content

Add unit coverage for the template launch dialog - #882

Merged
selfcontained merged 1 commit into
mainfrom
agt_69e64b742e37/job-test-enforcer-cb0395de
Aug 6, 2026
Merged

Add unit coverage for the template launch dialog#882
selfcontained merged 1 commit into
mainfrom
agt_69e64b742e37/job-test-enforcer-cb0395de

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Summary

  • LaunchTemplateDialog (automations-launch-dialog.tsx) had zero direct coverage despite owning the template launch contract and being the second consumer of the useStartupAttachments hook extracted in Extract shared useStartupAttachments hook #876 (the first consumer path is pinned via use-create-agent-form.test.tsx).
  • Adds 13 jsdom tests that render the real dialog, the real useTemplateActions mutation, and the real ContextPicker, mocking only the HTTP seam (@/lib/api) and the toast sink — so the whole chain from form state to wire payload is pinned end to end.

What's pinned

  • Required-arg gating (blank + whitespace) including the Enter-key submit path that bypasses the disabled button, with a microtask flush so the no-call assertion observes settled state
  • Optional args never block launching; typed args sent keyed by lowercased name, untouched ones omitted
  • Agent-type override via the combobox reaches the payload
  • JSON branch: exact body (agentType only for no-arg templates; no stray args/startup fields)
  • Multipart branch: dropped files (deduped across drops), popover-added links, args, and agentType all land in FormData; removed files stay out; absent fields are absent, not serialized empties
  • Success closes the dialog and navigates to the new agent (asserted via real router location); failure toasts and stays open; resubmits while pending are suppressed (asserted after settle)
  • Terminal templates hide the agent-type select and media affordances; allowMedia: false ignores drops; drop zone arms only for file drags

Verification

  • 12-mutant battery against the dialog + launchTemplate mutation — all killed (one submit-gate mutant initially survived a too-early assertion; fixed by asserting post-settle)
  • One general review round: 0 must-fix; 1 should-fix + 2 nits applied (microtask flush, positive control for empty-state copy, pin POST method)
  • pnpm run check, full unit suites (web 617→630), pnpm run finalize:web, inert E2E 175 passed, live lane 11 passed

🤖 Generated with Claude Code

LaunchTemplateDialog (automations-launch-dialog.tsx) had zero direct
coverage despite owning the template launch contract: required-arg
gating, agent-type override, the JSON-vs-multipart wire payload, and the
consumer wiring of the shared useStartupAttachments hook. 13 jsdom tests
render the real dialog, mutation, and context picker with only the HTTP
and toast seams mocked, pinning both payload branches end to end plus
success navigation, error toast, pending-resubmit suppression, and the
terminal/allowMedia gating. A 12-mutant battery was verified killed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 2b482e5 into mainAug 6, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_69e64b742e37/job-test-enforcer-cb0395de branch August 6, 2026 02:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@selfcontained