import { describe, it, expect, vi, beforeEach } from 'vitest' vi.mock('@/lib/prisma', () => ({ prisma: { sprint: { findFirst: vi.fn(), }, }, })) vi.mock('@/lib/api-auth', () => ({ authenticateApiRequest: vi.fn(), })) import { prisma } from '@/lib/prisma' import { authenticateApiRequest } from '@/lib/api-auth' import { GET as getSprintTasks } from '@/app/api/sprints/[id]/tasks/route' const mockPrisma = prisma as unknown as { sprint: { findFirst: ReturnType } } const mockAuth = authenticateApiRequest as ReturnType function makeRequest(sprintId = 'sprint-1', limit?: number): [Request, { params: Promise<{ id: string }> }] { const url = limit ? `http://localhost/api/sprints/${sprintId}/tasks?limit=${limit}` : `http://localhost/api/sprints/${sprintId}/tasks` return [ new Request(url, { method: 'GET', headers: { Authorization: 'Bearer test-token' }, }), { params: Promise.resolve({ id: sprintId }) }, ] } describe('GET /api/sprints/:id/tasks', () => { beforeEach(() => { vi.clearAllMocks() }) // TC-ST-01 it.todo('returns 401 when no token provided') // TC-ST-03 it.todo('returns 404 when sprint is not accessible') // TC-ST-04 it.todo('returns 404 for another user\'s sprint') // TC-ST-05 it.todo('applies default limit of 10 when no limit param given') // TC-ST-06 it.todo('respects custom limit param') // TC-ST-07 it.todo('handles limit=1 boundary') // TC-ST-08 it.todo('returns empty array when sprint has no tasks') })