fix(documents): port-scope folder test cleanup + tighten parent-validation message

Code-review followups on 4b31f01:
- beforeEach now scopes the documentFolders cleanup to the test port
  via .where(eq(documentFolders.portId, portId)) so parallel suites
  don't wipe each other's fixtures.
- Cross-port parent guard message changed from "Parent folder not
  found in this port" (read like a 404) to "Invalid parent folder"
  to match the ValidationError type that already maps to 400.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 19:36:31 +02:00
parent 4b31f01a04
commit 5c5ab49218
2 changed files with 6 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ export async function createFolder(
const parent = await db.query.documentFolders.findFirst({
where: and(eq(documentFolders.id, data.parentId), eq(documentFolders.portId, portId)),
});
if (!parent) throw new ValidationError('Parent folder not found in this port');
if (!parent) throw new ValidationError('Invalid parent folder');
}
try {