Skip to content

Add unit coverage for the web half of the #844 media consolidation - #851

Merged
selfcontained merged 1 commit into
mainfrom
agt_6ddeefbd4bd0/job-test-enforcer-c03daf09
Jul 30, 2026
Merged

Add unit coverage for the web half of the #844 media consolidation#851
selfcontained merged 1 commit into
mainfrom
agt_6ddeefbd4bd0/job-test-enforcer-c03daf09

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Summary

  • Adds apps/web/src/lib/media-upload.test.ts (12 tests): isAcceptedUploadFile extension pre-filter — every accepted extension, case-insensitivity, multi-dot names, no-extension/trailing-dot/unsupported rejects, plus a parity test pinning the client pre-filter to the server's authoritative isMediaFile; uploadAgentMedia — asserts the real FormData payload (endpoint URL, POST method, file bytes + name, source default and override, inject flag presence semantics) and error propagation.
  • Adds apps/web/src/components/app/media-file-utils.test.ts (5 tests): stripTimestamp suffix and mid-name stripping, date-only and hyphen-less near-misses left intact.

These modules were the untested web half of the #844 media consolidation (terminal-uploads.test.ts mocks @/lib/media-upload entirely, so none of this logic was previously exercised). The server half is already covered by apps/server/test/shared-media.test.ts.

Validation

  • 9-mutant battery (toLowerCase drop, slice-past-dot, source/inject mutations, endpoint/method/return mutations, regex hyphen/digit mutations): 9/9 killed.
  • pnpm run check, full unit suites (server 2362, web 516, ext 60, scripts 4), pnpm run finalize:web, and E2E (174 passed / 12 skipped, twice) all green.
  • One general review agent inspected the diff: 0 must-fix, 0 should-fix, 3 nits (1 applied — dropped a non-discriminating duplicate assertion).

🤖 Generated with Claude Code

Covers apps/web/src/lib/media-upload.ts (isAcceptedUploadFile extension
pre-filter incl. a parity test against the server's authoritative
isMediaFile, and uploadAgentMedia's FormData payload: endpoint, method,
file bytes/name, source default and override, inject flag semantics,
error propagation) and stripTimestamp in media-file-utils.ts (suffix and
mid-name stripping, date-only and hyphen-less near-misses left intact).

17 tests; 9-mutant battery all killed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 1c6c94e into main Jul 30, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_6ddeefbd4bd0/job-test-enforcer-c03daf09 branch July 30, 2026 02:19
Sign up for free to 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