test: verify_only PATCH + verify_result dialog render + store fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-01 12:51:24 +02:00
parent 0069c600f2
commit 859ca1bcd0
3 changed files with 210 additions and 0 deletions

View file

@ -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',