ST-1242: Verwijder todo-tests, herstel security-test en verifieer volledige build (#134)

* feat(cleanup): verwijder Todo's navlink en todo-referenties uit marketing page [cmotto5ia000nx3178lq6xk8d]

- nav-bar.tsx: Todo's navLink verwijderd; Ideas-link blijft staan
- app/page.tsx: /todos quick-access link, feature-entry en /api/todos API-doc verwijderd

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(cleanup): verwijder app/(app)/todos/ en components/todos/ [cmottjvzo000cx3172472cu4g]

* test(cleanup): verwijder POST /api/todos import en describe-block uit security.test.ts [cmotto5jn000px317kjqlba89]

- Import 'POST as postTodo' uit verwijderde todos-route verwijderd
- describe('POST /api/todos') sectie (3 tests) verwijderd
- 73 testfiles / 561 tests groen

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(cleanup): verwijder __tests__/api/todos.test.ts en __tests__/actions/todos-promote-idea.test.ts [cmottjw1u000fx317igq27mh5]

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-06 12:24:29 +02:00 committed by GitHub
parent 628fbd7e7b
commit 52c610b11c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 0 additions and 267 deletions

View file

@ -1,114 +0,0 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
const { mockSession } = vi.hoisted(() => ({
mockSession: { userId: 'user-1', isDemo: false },
}))
vi.mock('next/cache', () => ({ revalidatePath: vi.fn() }))
vi.mock('next/headers', () => ({ cookies: vi.fn().mockResolvedValue({}) }))
vi.mock('iron-session', () => ({
getIronSession: vi.fn().mockImplementation(async () => mockSession),
}))
vi.mock('@/lib/session', () => ({
sessionOptions: { cookieName: 'test', password: 'test-password-32-chars-minimum-len' },
}))
vi.mock('@/lib/idea-code-server', () => ({
nextIdeaCode: vi.fn().mockResolvedValue('IDEA-005'),
}))
vi.mock('@/lib/product-access', () => ({
productAccessFilter: vi.fn().mockReturnValue({}),
}))
vi.mock('@/lib/code-server', () => ({
generateNextPbiCode: vi.fn(),
generateNextStoryCode: vi.fn(),
}))
vi.mock('@/lib/rate-limit', () => ({
enforceUserRateLimit: vi.fn().mockReturnValue(null),
}))
vi.mock('@/lib/prisma', () => ({
prisma: {
todo: {
findFirst: vi.fn(),
update: vi.fn(),
},
idea: {
create: vi.fn(),
},
ideaLog: { create: vi.fn() },
$transaction: vi.fn(),
},
}))
import { prisma } from '@/lib/prisma'
import { promoteTodoToIdeaAction } from '@/actions/todos'
type M = {
todo: { findFirst: ReturnType<typeof vi.fn>; update: ReturnType<typeof vi.fn> }
idea: { create: ReturnType<typeof vi.fn> }
ideaLog: { create: ReturnType<typeof vi.fn> }
$transaction: ReturnType<typeof vi.fn>
}
const m = prisma as unknown as M
beforeEach(() => {
vi.clearAllMocks()
mockSession.userId = 'user-1'
mockSession.isDemo = false
m.$transaction.mockImplementation(async (arg: unknown) => {
if (typeof arg === 'function') {
return (arg as (tx: unknown) => unknown)(m)
}
return arg
})
})
describe('promoteTodoToIdeaAction', () => {
it('happy: archives todo, creates DRAFT idea, returns idea_id', async () => {
m.todo.findFirst.mockResolvedValueOnce({
id: 'todo-1',
title: 'My idea',
description: 'desc',
product_id: null,
archived: false,
})
m.idea.create.mockResolvedValueOnce({ id: 'idea-9', code: 'IDEA-005' })
const r = await promoteTodoToIdeaAction('todo-1')
expect(r).toMatchObject({ success: true, idea_id: 'idea-9', idea_code: 'IDEA-005' })
expect(m.todo.update).toHaveBeenCalledWith({
where: { id: 'todo-1' },
data: { archived: true },
})
})
it('rejects unauthenticated', async () => {
mockSession.userId = ''
const r = await promoteTodoToIdeaAction('todo-1')
expect(r).toMatchObject({ code: 401 })
})
it('rejects demo-user', async () => {
mockSession.isDemo = true
const r = await promoteTodoToIdeaAction('todo-1')
expect(r).toMatchObject({ code: 403 })
})
it('returns 404 when todo belongs to another user', async () => {
m.todo.findFirst.mockResolvedValueOnce(null)
const r = await promoteTodoToIdeaAction('todo-1')
expect(r).toMatchObject({ code: 404 })
})
it('rejects already-archived todo', async () => {
m.todo.findFirst.mockResolvedValueOnce({
id: 'todo-1',
title: 'x',
description: null,
product_id: null,
archived: true,
})
const r = await promoteTodoToIdeaAction('todo-1')
expect(r).toMatchObject({ code: 422 })
expect(m.idea.create).not.toHaveBeenCalled()
})
})