Files
oh-my-pi/packages/coding-agent/test/tools/task-template.test.ts
T
can1357 2e20d87151 feat(coding-agent): simplified skill management by removing per-task pinning
- Removed per-task skill pinning feature; subagents now inherit session skill set instead of per-task selection.
- Removed `preloadedSkills` option from `CreateAgentSessionOptions` interface and related system prompt plumbing.
- Removed `skills` field from Task schema; task execution now passes available session skills directly to subagents.
- Simplified task execution pipeline by removing skill resolution logic and preloaded skills handling from system prompt templates.
2026-02-26 20:47:54 +01:00

47 lines
1.7 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { sectionSeparator } from "@oh-my-pi/pi-coding-agent/config/prompt-templates";
import { renderTemplate } from "@oh-my-pi/pi-coding-agent/task/template";
describe("renderTemplate", () => {
test("returns assignment as task when no context", () => {
const result = renderTemplate(undefined, {
id: "Test",
description: "Short label",
assignment: "Do the thing in detail.\nStep 1: read file.\nStep 2: edit it.",
});
expect(result.task).toBe("Do the thing in detail.\nStep 1: read file.\nStep 2: edit it.");
expect(result.id).toBe("Test");
expect(result.description).toBe("Short label");
});
test("prepends context with separator when provided", () => {
const result = renderTemplate("Shared constraints here", {
id: "TaskA",
description: "First task",
assignment: "Full instructions for the agent.\nWith multiple lines.",
});
expect(result.task).toContain("Shared constraints here");
expect(result.task).toContain(sectionSeparator("Background").trimStart());
expect(result.task).toContain("Full instructions for the agent.\nWith multiple lines.");
});
test("trims context whitespace", () => {
const result = renderTemplate(" \n context \n ", {
id: "X",
description: "label",
assignment: "the real work",
});
expect(result.task).toStartWith(`${sectionSeparator("Background").trimStart()}\ncontext`);
expect(result.task).toContain("the real work");
});
test("empty context treated as absent", () => {
const result = renderTemplate(" ", {
id: "X",
description: "label",
assignment: "just the assignment",
});
expect(result.task).toBe("just the assignment");
});
});