Files
accounted/extensions/general/mcp-server/__tests__/prompts.test.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

41 lines
1.1 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { prompts, findPrompt } from '../prompts'
describe('mcp prompt registry', () => {
it('exposes the five single-action prompts', () => {
expect(prompts).toHaveLength(5)
const names = prompts.map((p) => p.name).sort()
expect(names).toEqual([
'cash_today',
'last_month_result',
'uncategorized_count',
'vat_due',
'whats_overdue',
])
})
it('every prompt has description and non-trivial text', () => {
for (const p of prompts) {
expect(p.description).toBeTruthy()
expect(p.text.length).toBeGreaterThan(40)
}
})
it('prompt names are snake_case and unique', () => {
const seen = new Set<string>()
for (const p of prompts) {
expect(p.name).toMatch(/^[a-z][a-z0-9_]*$/)
expect(seen.has(p.name)).toBe(false)
seen.add(p.name)
}
})
it('findPrompt returns the matching prompt', () => {
expect(findPrompt('vat_due')?.name).toBe('vat_due')
})
it('findPrompt returns null for an unknown name', () => {
expect(findPrompt('does_not_exist')).toBeNull()
})
})