Add unit coverage for the web half of the #844 media consolidation - #851
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/web/src/lib/media-upload.test.ts(12 tests):isAcceptedUploadFileextension 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 authoritativeisMediaFile;uploadAgentMedia— asserts the real FormData payload (endpoint URL, POST method, file bytes + name,sourcedefault and override,injectflag presence semantics) and error propagation.apps/web/src/components/app/media-file-utils.test.ts(5 tests):stripTimestampsuffix 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.tsmocks@/lib/media-uploadentirely, so none of this logic was previously exercised). The server half is already covered byapps/server/test/shared-media.test.ts.Validation
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.🤖 Generated with Claude Code