diff --git a/__tests__/api/tasks.test.ts b/__tests__/api/tasks.test.ts index ed0616e..3b08da7 100644 --- a/__tests__/api/tasks.test.ts +++ b/__tests__/api/tasks.test.ts @@ -200,6 +200,35 @@ describe('PATCH /api/tasks/:id', () => { }) }) + // TC-T-12 + it('updates verify_only alone and returns 200 with verify_only in response', async () => { + mockPrisma.task.update.mockResolvedValue({ id: 'task-1', status: 'TO_DO', implementation_plan: null, verify_only: true }) + + const res = await patchTask(...makeRequest({ verify_only: true })) + const data = await res.json() + + expect(res.status).toBe(200) + expect(data.verify_only).toBe(true) + expect(mockPrisma.task.update).toHaveBeenCalledWith( + expect.objectContaining({ data: { verify_only: true } }), + ) + }) + + it('combines verify_only and implementation_plan into one update call', async () => { + const plan = 'Verify only: check test results.' + mockPrisma.task.update.mockResolvedValue({ id: 'task-1', status: 'TO_DO', implementation_plan: plan, verify_only: true }) + + const res = await patchTask(...makeRequest({ implementation_plan: plan, verify_only: true })) + const data = await res.json() + + expect(res.status).toBe(200) + expect(data).toMatchObject({ implementation_plan: plan, verify_only: true }) + expect(mockPrisma.task.update).toHaveBeenCalledTimes(1) + expect(mockPrisma.task.update).toHaveBeenCalledWith( + expect.objectContaining({ data: { implementation_plan: plan, verify_only: true } }), + ) + }) + it('returns 400 for malformed JSON', async () => { const req = new Request('http://localhost/api/tasks/task-1', { method: 'PATCH', diff --git a/__tests__/components/solo/task-detail-dialog.test.tsx b/__tests__/components/solo/task-detail-dialog.test.tsx new file mode 100644 index 0000000..a1ef88b --- /dev/null +++ b/__tests__/components/solo/task-detail-dialog.test.tsx @@ -0,0 +1,180 @@ +// @vitest-environment jsdom +import '@testing-library/jest-dom' +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen, fireEvent, waitFor } from '@testing-library/react' +import type { SoloTask } from '@/components/solo/solo-board' + +// Mock heavy UI primitives to avoid portal/JSDOM issues +vi.mock('@/components/ui/dialog', () => ({ + Dialog: ({ open, children }: { open: boolean; onOpenChange?: () => void; children: React.ReactNode }) => + open ?
{children}
: null, + DialogContent: ({ children }: { children: React.ReactNode }) =>
{children}
, + DialogHeader: ({ children }: { children: React.ReactNode }) =>
{children}
, + DialogTitle: ({ children }: { children: React.ReactNode }) =>

{children}

, +})) +vi.mock('@/components/ui/tooltip', () => ({ + TooltipProvider: ({ children }: { children: React.ReactNode }) => <>{children}, + Tooltip: ({ children }: { children: React.ReactNode }) => <>{children}, + TooltipTrigger: ({ render: r, children }: { render?: React.ReactElement; children?: React.ReactNode }) => + r ? <>{r} : <>{children}, + TooltipContent: ({ children }: { children: React.ReactNode }) => {children}, +})) +vi.mock('@/components/ui/textarea', () => ({ + Textarea: (props: React.TextareaHTMLAttributes) =>