chore: prettier formatter drift across recent commits

Prettier reformatting on files touched in the wave 11.B sequence —
markdown italics _underscore-style_, single-line conditionals, minor
whitespace fixes. No semantic changes. .env.example reformatting left
unstaged (blocked by pre-commit hook).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 10:57:37 +02:00
parent 286eb51f81
commit 5422f11747
10 changed files with 82 additions and 95 deletions

View File

@@ -124,13 +124,17 @@ describe('document-folders service · renameFolder', () => {
it('rejects rename to an existing sibling name', async () => {
await createFolder(portId, TEST_USER_ID, { name: 'Existing', parentId: null });
const folder = await createFolder(portId, TEST_USER_ID, { name: 'Mine', parentId: null });
await expect(renameFolder(portId, folder.id, 'Existing', TEST_USER_ID)).rejects.toThrow(/already exists/i);
await expect(renameFolder(portId, folder.id, 'Existing', TEST_USER_ID)).rejects.toThrow(
/already exists/i,
);
});
it('throws NotFound when the folder belongs to another port', async () => {
const otherPort = await makePort();
const folder = await createFolder(otherPort.id, TEST_USER_ID, { name: 'X', parentId: null });
await expect(renameFolder(portId, folder.id, 'Y', TEST_USER_ID)).rejects.toThrow(/couldn't find/i);
await expect(renameFolder(portId, folder.id, 'Y', TEST_USER_ID)).rejects.toThrow(
/couldn't find/i,
);
});
});

View File

@@ -4,10 +4,7 @@ import { eq } from 'drizzle-orm';
import { db } from '@/lib/db';
import { documentFolders, documents } from '@/lib/db/schema/documents';
import { user } from '@/lib/db/schema/users';
import {
createFolder,
deleteFolderSoftRescue,
} from '@/lib/services/document-folders.service';
import { createFolder, deleteFolderSoftRescue } from '@/lib/services/document-folders.service';
import { makePort } from '../helpers/factories';
describe('document-folders · deleteFolderSoftRescue', () => {
@@ -25,7 +22,7 @@ describe('document-folders · deleteFolderSoftRescue', () => {
await db.delete(documentFolders).where(eq(documentFolders.portId, portId));
});
it('moves child subfolders up to the deleted folder\'s parent', async () => {
it("moves child subfolders up to the deleted folder's parent", async () => {
const root = await createFolder(portId, testUserId, { name: 'Root', parentId: null });
const middle = await createFolder(portId, testUserId, { name: 'Middle', parentId: root.id });
const leaf = await createFolder(portId, testUserId, { name: 'Leaf', parentId: middle.id });
@@ -38,7 +35,7 @@ describe('document-folders · deleteFolderSoftRescue', () => {
expect(survivor?.parentId).toBe(root.id);
});
it('moves child documents to the deleted folder\'s parent', async () => {
it("moves child documents to the deleted folder's parent", async () => {
const root = await createFolder(portId, testUserId, { name: 'Root', parentId: null });
const child = await createFolder(portId, testUserId, { name: 'Child', parentId: root.id });

View File

@@ -98,9 +98,8 @@ describe('GET /api/v1/documents/[id]/download/[...slug]', () => {
storagePath: 'test/contract.pdf',
});
const { downloadHandler } = await import(
'@/app/api/v1/documents/[id]/download/[...slug]/handlers'
);
const { downloadHandler } =
await import('@/app/api/v1/documents/[id]/download/[...slug]/handlers');
const ctx = makeMockCtx({ portId: port.id, permissions: makeFullPermissions() });
const req = new Request('http://localhost/api/v1/documents/x/download/whatever') as never;
const res = await downloadHandler(req, ctx, {
@@ -124,9 +123,8 @@ describe('GET /api/v1/documents/[id]/download/[...slug]', () => {
storagePath: 'test/spec.pdf',
});
const { downloadHandler } = await import(
'@/app/api/v1/documents/[id]/download/[...slug]/handlers'
);
const { downloadHandler } =
await import('@/app/api/v1/documents/[id]/download/[...slug]/handlers');
const ctx = makeMockCtx({ portId: port.id, permissions: makeFullPermissions() });
const req = new Request('http://localhost/x') as never;
const res = await downloadHandler(req, ctx, {
@@ -147,9 +145,8 @@ describe('GET /api/v1/documents/[id]/download/[...slug]', () => {
storagePath: 'test/real.pdf',
});
const { downloadHandler } = await import(
'@/app/api/v1/documents/[id]/download/[...slug]/handlers'
);
const { downloadHandler } =
await import('@/app/api/v1/documents/[id]/download/[...slug]/handlers');
const ctx = makeMockCtx({ portId: port.id, permissions: makeFullPermissions() });
const req = new Request('http://localhost/x') as never;
const res = await downloadHandler(req, ctx, {
@@ -172,9 +169,8 @@ describe('GET /api/v1/documents/[id]/download/[...slug]', () => {
})
.returning();
const { downloadHandler } = await import(
'@/app/api/v1/documents/[id]/download/[...slug]/handlers'
);
const { downloadHandler } =
await import('@/app/api/v1/documents/[id]/download/[...slug]/handlers');
const ctx = makeMockCtx({ portId: port.id, permissions: makeFullPermissions() });
const req = new Request('http://localhost/x') as never;
const res = await downloadHandler(req, ctx, {
@@ -199,9 +195,8 @@ describe('GET /api/v1/documents/[id]/download/[...slug]', () => {
storagePath: 'test/a.pdf',
});
const { downloadHandler } = await import(
'@/app/api/v1/documents/[id]/download/[...slug]/handlers'
);
const { downloadHandler } =
await import('@/app/api/v1/documents/[id]/download/[...slug]/handlers');
const ctx = makeMockCtx({ portId: portB.id, permissions: makeFullPermissions() });
const req = new Request('http://localhost/x') as never;
const res = await downloadHandler(req, ctx, {

View File

@@ -9,16 +9,14 @@ import {
describe('document-folder validators', () => {
it('accepts a valid create payload', () => {
expect(createFolderSchema.safeParse({ name: 'Deals', parentId: null }).success).toBe(true);
expect(
createFolderSchema.safeParse({ name: 'Q1', parentId: 'abc-123' }).success,
).toBe(true);
expect(createFolderSchema.safeParse({ name: 'Q1', parentId: 'abc-123' }).success).toBe(true);
});
it('rejects empty + over-long names', () => {
expect(createFolderSchema.safeParse({ name: '', parentId: null }).success).toBe(false);
expect(
createFolderSchema.safeParse({ name: 'x'.repeat(201), parentId: null }).success,
).toBe(false);
expect(createFolderSchema.safeParse({ name: 'x'.repeat(201), parentId: null }).success).toBe(
false,
);
});
it('rejects whitespace-only names', () => {