chore: establish learning module baseline

This commit is contained in:
inman committed 2026-08-16 14:58:47 +08:00
commit 2d04197f3f
2409 files changed
+533050

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { describe, test, expect } from 'vitest';
import { loadPrompt, loadSnippet, buildPrompt } from '@openmaic/generation';
describe('@openmaic/generation prompt loader', () => {
test('loads a known template + interpolates variables', () => {
const result = buildPrompt('slide-actions', {
title: 'Test Slide',
keyPoints: '1. point one',
description: 'desc',
elements: '[]',
courseContext: '',
agents: '',
userProfile: '',
languageDirective: 'en',
});
expect(result).not.toBeNull();
expect(result!.system.length).toBeGreaterThan(100);
expect(result!.user).toContain('Test Slide');
});
test('loads a snippet', () => {
const s = loadSnippet('json-output-rules');
expect(s).toContain('JSON');
});
test('returns null for unknown promptId', () => {
// @ts-expect-error — testing runtime behavior with invalid id
expect(loadPrompt('does-not-exist')).toBeNull();
});
test('throws on unknown snippetId instead of passing through literal', () => {
// @ts-expect-error — testing runtime behavior with invalid id
expect(() => loadSnippet('does-not-exist')).toThrow(/Snippet not found/);
});
});