- Next.js 14+ with App Router and TypeScript - Tailwind CSS and ShadCN UI styling - Zustand state management - Dexie.js for IndexedDB (local-first data) - Auth.js v5 for authentication - BMAD framework integration Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
// @ts-ignore - Module likely not created yet
|
|
import { PromptEngine } from '@/lib/llm/prompt-engine';
|
|
|
|
describe('PromptEngine (Ghostwriter)', () => {
|
|
it('should construct a grounded prompt with user insight', () => {
|
|
// GIVEN: A user insight and chat history
|
|
const history = [
|
|
{ role: 'user', content: 'I feel stupid.' },
|
|
{ role: 'assistant', content: 'Why?' },
|
|
{ role: 'user', content: 'I made a typo.' }
|
|
];
|
|
const insight = "I need a checklist for typos.";
|
|
|
|
// WHEN: Constructing the prompt
|
|
// @ts-ignore
|
|
const prompt = PromptEngine.constructGhostwriterPrompt(history, insight);
|
|
|
|
// THEN: The system prompt should enforce grounding
|
|
expect(prompt[0].role).toBe('system');
|
|
expect(prompt[0].content).toContain('You are an expert Ghostwriter');
|
|
expect(prompt[0].content).toContain('Ground your answer in the user insight'); // R-2.1 Mitigation
|
|
|
|
// AND: The user insight should be clearly labeled
|
|
const lastMessage = prompt[prompt.length - 1];
|
|
expect(lastMessage.content).toContain(`INSIGHT: ${insight}`);
|
|
});
|
|
});
|