Skip to content

Add SettingsTab component tests for jobs settings - #908

Merged
selfcontained merged 1 commit into
mainfrom
agt_5235e89493b6/job-test-enforcer-3468a75e
Aug 9, 2026
Merged

Add SettingsTab component tests for jobs settings#908
selfcontained merged 1 commit into
mainfrom
agt_5235e89493b6/job-test-enforcer-3468a75e

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Summary

  • Adds apps/web/src/components/app/jobs-settings-tab.test.tsx — 21 jsdom tests pinning the jobs SettingsTab contract, which had no direct component coverage (only jobs-helpers unit tests existed). This closes the Extract shared JobScheduleField and JobAgentTypeField #880 jobs-form-fields follow-up from the recurring test-enforcer job: the extracted JobScheduleField/JobAgentTypeField/option components are now exercised through their real consumer.

What the tests pin

  • Save payload contract (exact-object assertions against a single-field-delta base payload): minute→ms conversions, schedule trim-to-null, worktree gating (baseBranch/branchName nulled when unchecked), the keepAgentautoArchive inversion, and every advanced toggle passthrough.
  • Save gating: empty name, invalid cron (error rendered + Save disabled), unparseable timeout minutes.
  • Enabled toggle: disabled until a schedule is saved, optimistic set with an exact minimal payload ({name, directory, enabled}), revert + error banner on failure, single-fire while in flight.
  • Job identity: unsaved edits survive a same-id refetch (the SSE no-clobber behavior), full reset — including the enabled switch — on job switch.
  • Agent type/model: only CLI agent types offered (Terminal filtered), model reset to null on type change.
  • Webhook branches and the confirm-gated remove flow (success closes, failure keeps dialog open with the error).

Test design

  • Real child tree (jobs-form-fields, BranchSelect, AgentModelSelect) and real react-query model-catalog query; only @/lib/api is mocked.
  • 11-mutant battery run against jobs-settings-tab.tsx/jobs-form-fields.tsx — all killed (payload gating, inversion, model reset, CLI filter, showEnabled, reset-effect deps, revert-on-error, enabled reset).
  • Reviewed by a general review agent: 0 must-fix, 0 should-fix; 3 hygiene nits applied (gcTime: 0, single-call assertion, clickSave stale-banner guard).

Validation

  • pnpm run check
  • pnpm --filter @dispatch/web test ✓ (55 files, 697 tests)
  • pnpm run finalize:web
  • Full suite green before changes: server 2479, inert E2E 178/12 skip, live lane 11 passed

🤖 Generated with Claude Code

Pin the jobs SettingsTab contract that had no direct coverage: the full
save payload (unit conversions, schedule trim-to-null, worktree branch
gating, the keepAgent -> autoArchive inversion), canSave gating, the
enabled toggle's minimal payload with optimistic set and revert on
error, the job-switch reset vs same-job refetch no-clobber behavior,
CLI-only agent types with model reset on type change, webhook URL
branches, and the confirm-gated remove flow.
Renders the real field components (jobs-form-fields, BranchSelect,
AgentModelSelect) with only the HTTP seam mocked; an 11-mutant battery
against the component all fail the suite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@selfcontained
selfcontained merged commit ed1ae66 into mainAug 9, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_5235e89493b6/job-test-enforcer-3468a75e branch August 9, 2026 02:25
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