cmte
Version:
Design by Committee™ except it's just you and LLMs
55 lines (44 loc) • 1.71 kB
JavaScript
import { TemplateRenderer } from '../renderer.js';
import path from 'path';
import { describe, test, expect, beforeEach } from 'vitest';
describe('TemplateRenderer', () => {
let renderer;
const mockTemplateDir = 'mock-templates';
beforeEach(() => {
renderer = new TemplateRenderer({}, mockTemplateDir);
});
describe('thinking output handling', () => {
test('automatically prepends thinking output by default', async () => {
const template = `---
title: Test Template
---
Template content`;
renderer.context = {
thinking: 'Previous thinking output'
};
const result = await renderer.render(template);
expect(result).toContain('# Your previous thoughts:\n\nPrevious thinking output\n\nTemplate content');
});
test('does not prepend thinking output when useThinkingOutputVariables is true', async () => {
const template = `---
title: Test Template
useThinkingOutputVariables: true
---
Template content with {{thinking}}`;
renderer.context = {
thinking: 'Previous thinking output'
};
const result = await renderer.render(template);
expect(result).not.toContain('# Your previous thoughts:');
expect(result).toContain('Template content with Previous thinking output');
});
test('prepends thinking output for templates without frontmatter', async () => {
const template = 'Simple template content';
renderer.context = {
thinking: 'Previous thinking output'
};
const result = await renderer.render(template);
expect(result).toContain('# Your previous thoughts:\n\nPrevious thinking output\n\nSimple template content');
});
});
});