Repository navigation
fix(web): fake folder access checks in the add-folder-videos test - #3108
Merged
richiemcilroy merged 1 commit intoOct 24, 2026
Merged
richiemcilroy merged 1 commit into
richiemcilroy merged 1 commit into
Conversation
add-folder-videos.test.ts fails 8 of its 10 tests on main. It was written against addVideosToFolder before the ownership checks from d2348b1 landed: its fake database still returns two-column folder rows, and the new getOrganizationAccess / getSpaceAccess lookups fall through to the catch-all branch, so access is only granted when a test happens to return shared rows. Fake both access helpers the way move-owned-videos.test.ts does and return the folder's organizationId. Add tests that a caller without access, and a folder from another organization, are rejected before anything is written; nothing covered those checks until now.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
Problem
apps/web/__tests__/unit/add-folder-videos.test.tsfails 8 of its 10 tests onmain, each withError: Folder not found.The test arrived in bd7648a, written against
addVideosToFolderbefore the ownership checks from d2348b1 were merged. That commit made the action selectorganizationIdalongsideidandspaceId, and callgetOrganizationAccess/getSpaceAccessbefore writing. Each change is fine on its own; together:organizationIdreads the space id andspaceIdis undefinedFix
getOrganizationAccessandgetSpaceAccesswith hoistedvi.fn()s, the waymove-owned-videos.test.tsdoes, defaulting to an authorised owner of the folder's organization.organizationIdin its row.New coverage
addVideosToFolderis only tested here, and d2348b1 added no tests, so its ownership checks had no coverage at all. Two new tests, run for both the space and organization variants, check that these are rejected before anything is written:They are not tautological. Mutating
add-videos.ts:folder.organizationId !== user.activeOrganizationIdaccess.organizationId !== folder.organizationIdVerification
bun run testinapps/web: 8 failed → 0 failed; total up by exactly the 4 new tests, nothing else affectedbun run typecheckexit 0,biome cicleanmainTest-only change;
add-videos.tsis untouched. The web unit suite isn't part of CI, which is how this went unnoticed.

Confidence Score: 5/5
This test-only change appears safe to merge.Summary
Repairs the database fixtures and access mocks in
add-folder-videos.test.ts.Reviews (1) · Last reviewed commit: "fix(web): fake folder access checks in t..." · Reviewed by Greptile