Files
accounted/extensions/general/mcp-server/__tests__/prompts.test.ts
T
Mattsson c03582b5c7 Fix/percistent mcp connection (#392)
* feat(oauth): add support for refresh tokens in OAuth flow and update database schema

* feat(prompts): add MCP prompts and corresponding functionality for prompt retrieval

* feat(auth): enhance error handling for refresh token operations and validation
2026-05-05 13:48:53 +02: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()
})
})