mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
style: fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import {
|
||||
getEnhancementPrompt,
|
||||
getSystemPrompt,
|
||||
@@ -15,38 +15,38 @@ import {
|
||||
SIMPLIFY_EXAMPLES,
|
||||
ACCEPTANCE_EXAMPLES,
|
||||
type EnhancementMode,
|
||||
} from "@/lib/enhancement-prompts.js";
|
||||
} from '@/lib/enhancement-prompts.js';
|
||||
|
||||
describe("enhancement-prompts.ts", () => {
|
||||
describe("System Prompt Constants", () => {
|
||||
it("should have non-empty improve system prompt", () => {
|
||||
describe('enhancement-prompts.ts', () => {
|
||||
describe('System Prompt Constants', () => {
|
||||
it('should have non-empty improve system prompt', () => {
|
||||
expect(IMPROVE_SYSTEM_PROMPT).toBeDefined();
|
||||
expect(IMPROVE_SYSTEM_PROMPT.length).toBeGreaterThan(100);
|
||||
expect(IMPROVE_SYSTEM_PROMPT).toContain("ANALYZE");
|
||||
expect(IMPROVE_SYSTEM_PROMPT).toContain("CLARIFY");
|
||||
expect(IMPROVE_SYSTEM_PROMPT).toContain('ANALYZE');
|
||||
expect(IMPROVE_SYSTEM_PROMPT).toContain('CLARIFY');
|
||||
});
|
||||
|
||||
it("should have non-empty technical system prompt", () => {
|
||||
it('should have non-empty technical system prompt', () => {
|
||||
expect(TECHNICAL_SYSTEM_PROMPT).toBeDefined();
|
||||
expect(TECHNICAL_SYSTEM_PROMPT.length).toBeGreaterThan(100);
|
||||
expect(TECHNICAL_SYSTEM_PROMPT).toContain("technical");
|
||||
expect(TECHNICAL_SYSTEM_PROMPT).toContain('technical');
|
||||
});
|
||||
|
||||
it("should have non-empty simplify system prompt", () => {
|
||||
it('should have non-empty simplify system prompt', () => {
|
||||
expect(SIMPLIFY_SYSTEM_PROMPT).toBeDefined();
|
||||
expect(SIMPLIFY_SYSTEM_PROMPT.length).toBeGreaterThan(100);
|
||||
expect(SIMPLIFY_SYSTEM_PROMPT).toContain("simplify");
|
||||
expect(SIMPLIFY_SYSTEM_PROMPT).toContain('simplify');
|
||||
});
|
||||
|
||||
it("should have non-empty acceptance system prompt", () => {
|
||||
it('should have non-empty acceptance system prompt', () => {
|
||||
expect(ACCEPTANCE_SYSTEM_PROMPT).toBeDefined();
|
||||
expect(ACCEPTANCE_SYSTEM_PROMPT.length).toBeGreaterThan(100);
|
||||
expect(ACCEPTANCE_SYSTEM_PROMPT).toContain("acceptance criteria");
|
||||
expect(ACCEPTANCE_SYSTEM_PROMPT).toContain('acceptance criteria');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Example Constants", () => {
|
||||
it("should have improve examples with input and output", () => {
|
||||
describe('Example Constants', () => {
|
||||
it('should have improve examples with input and output', () => {
|
||||
expect(IMPROVE_EXAMPLES).toBeDefined();
|
||||
expect(IMPROVE_EXAMPLES.length).toBeGreaterThan(0);
|
||||
IMPROVE_EXAMPLES.forEach((example) => {
|
||||
@@ -57,7 +57,7 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should have technical examples with input and output", () => {
|
||||
it('should have technical examples with input and output', () => {
|
||||
expect(TECHNICAL_EXAMPLES).toBeDefined();
|
||||
expect(TECHNICAL_EXAMPLES.length).toBeGreaterThan(0);
|
||||
TECHNICAL_EXAMPLES.forEach((example) => {
|
||||
@@ -66,7 +66,7 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should have simplify examples with input and output", () => {
|
||||
it('should have simplify examples with input and output', () => {
|
||||
expect(SIMPLIFY_EXAMPLES).toBeDefined();
|
||||
expect(SIMPLIFY_EXAMPLES.length).toBeGreaterThan(0);
|
||||
SIMPLIFY_EXAMPLES.forEach((example) => {
|
||||
@@ -75,7 +75,7 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should have acceptance examples with input and output", () => {
|
||||
it('should have acceptance examples with input and output', () => {
|
||||
expect(ACCEPTANCE_EXAMPLES).toBeDefined();
|
||||
expect(ACCEPTANCE_EXAMPLES.length).toBeGreaterThan(0);
|
||||
ACCEPTANCE_EXAMPLES.forEach((example) => {
|
||||
@@ -85,66 +85,66 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("getEnhancementPrompt", () => {
|
||||
it("should return config for improve mode", () => {
|
||||
const config = getEnhancementPrompt("improve");
|
||||
describe('getEnhancementPrompt', () => {
|
||||
it('should return config for improve mode', () => {
|
||||
const config = getEnhancementPrompt('improve');
|
||||
expect(config.systemPrompt).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
expect(config.description).toContain("clear");
|
||||
expect(config.description).toContain('clear');
|
||||
});
|
||||
|
||||
it("should return config for technical mode", () => {
|
||||
const config = getEnhancementPrompt("technical");
|
||||
it('should return config for technical mode', () => {
|
||||
const config = getEnhancementPrompt('technical');
|
||||
expect(config.systemPrompt).toBe(TECHNICAL_SYSTEM_PROMPT);
|
||||
expect(config.description).toContain("technical");
|
||||
expect(config.description).toContain('technical');
|
||||
});
|
||||
|
||||
it("should return config for simplify mode", () => {
|
||||
const config = getEnhancementPrompt("simplify");
|
||||
it('should return config for simplify mode', () => {
|
||||
const config = getEnhancementPrompt('simplify');
|
||||
expect(config.systemPrompt).toBe(SIMPLIFY_SYSTEM_PROMPT);
|
||||
expect(config.description).toContain("concise");
|
||||
expect(config.description).toContain('concise');
|
||||
});
|
||||
|
||||
it("should return config for acceptance mode", () => {
|
||||
const config = getEnhancementPrompt("acceptance");
|
||||
it('should return config for acceptance mode', () => {
|
||||
const config = getEnhancementPrompt('acceptance');
|
||||
expect(config.systemPrompt).toBe(ACCEPTANCE_SYSTEM_PROMPT);
|
||||
expect(config.description).toContain("acceptance");
|
||||
expect(config.description).toContain('acceptance');
|
||||
});
|
||||
|
||||
it("should handle case-insensitive mode", () => {
|
||||
const config = getEnhancementPrompt("IMPROVE");
|
||||
it('should handle case-insensitive mode', () => {
|
||||
const config = getEnhancementPrompt('IMPROVE');
|
||||
expect(config.systemPrompt).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
});
|
||||
|
||||
it("should fall back to improve for invalid mode", () => {
|
||||
const config = getEnhancementPrompt("invalid-mode");
|
||||
it('should fall back to improve for invalid mode', () => {
|
||||
const config = getEnhancementPrompt('invalid-mode');
|
||||
expect(config.systemPrompt).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
});
|
||||
|
||||
it("should fall back to improve for empty string", () => {
|
||||
const config = getEnhancementPrompt("");
|
||||
it('should fall back to improve for empty string', () => {
|
||||
const config = getEnhancementPrompt('');
|
||||
expect(config.systemPrompt).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getSystemPrompt", () => {
|
||||
it("should return correct system prompt for each mode", () => {
|
||||
expect(getSystemPrompt("improve")).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt("technical")).toBe(TECHNICAL_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt("simplify")).toBe(SIMPLIFY_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt("acceptance")).toBe(ACCEPTANCE_SYSTEM_PROMPT);
|
||||
describe('getSystemPrompt', () => {
|
||||
it('should return correct system prompt for each mode', () => {
|
||||
expect(getSystemPrompt('improve')).toBe(IMPROVE_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt('technical')).toBe(TECHNICAL_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt('simplify')).toBe(SIMPLIFY_SYSTEM_PROMPT);
|
||||
expect(getSystemPrompt('acceptance')).toBe(ACCEPTANCE_SYSTEM_PROMPT);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getExamples", () => {
|
||||
it("should return correct examples for each mode", () => {
|
||||
expect(getExamples("improve")).toBe(IMPROVE_EXAMPLES);
|
||||
expect(getExamples("technical")).toBe(TECHNICAL_EXAMPLES);
|
||||
expect(getExamples("simplify")).toBe(SIMPLIFY_EXAMPLES);
|
||||
expect(getExamples("acceptance")).toBe(ACCEPTANCE_EXAMPLES);
|
||||
describe('getExamples', () => {
|
||||
it('should return correct examples for each mode', () => {
|
||||
expect(getExamples('improve')).toBe(IMPROVE_EXAMPLES);
|
||||
expect(getExamples('technical')).toBe(TECHNICAL_EXAMPLES);
|
||||
expect(getExamples('simplify')).toBe(SIMPLIFY_EXAMPLES);
|
||||
expect(getExamples('acceptance')).toBe(ACCEPTANCE_EXAMPLES);
|
||||
});
|
||||
|
||||
it("should return arrays with example objects", () => {
|
||||
const modes: EnhancementMode[] = ["improve", "technical", "simplify", "acceptance"];
|
||||
it('should return arrays with example objects', () => {
|
||||
const modes: EnhancementMode[] = ['improve', 'technical', 'simplify', 'acceptance'];
|
||||
modes.forEach((mode) => {
|
||||
const examples = getExamples(mode);
|
||||
expect(Array.isArray(examples)).toBe(true);
|
||||
@@ -153,38 +153,38 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildUserPrompt", () => {
|
||||
const testText = "Add a logout button";
|
||||
describe('buildUserPrompt', () => {
|
||||
const testText = 'Add a logout button';
|
||||
|
||||
it("should build prompt with examples by default", () => {
|
||||
const prompt = buildUserPrompt("improve", testText);
|
||||
expect(prompt).toContain("Example 1:");
|
||||
it('should build prompt with examples by default', () => {
|
||||
const prompt = buildUserPrompt('improve', testText);
|
||||
expect(prompt).toContain('Example 1:');
|
||||
expect(prompt).toContain(testText);
|
||||
expect(prompt).toContain("Now, please enhance the following task description:");
|
||||
expect(prompt).toContain('Now, please enhance the following task description:');
|
||||
});
|
||||
|
||||
it("should build prompt without examples when includeExamples is false", () => {
|
||||
const prompt = buildUserPrompt("improve", testText, false);
|
||||
expect(prompt).not.toContain("Example 1:");
|
||||
it('should build prompt without examples when includeExamples is false', () => {
|
||||
const prompt = buildUserPrompt('improve', testText, false);
|
||||
expect(prompt).not.toContain('Example 1:');
|
||||
expect(prompt).toContain(testText);
|
||||
expect(prompt).toContain("Please enhance the following task description:");
|
||||
expect(prompt).toContain('Please enhance the following task description:');
|
||||
});
|
||||
|
||||
it("should include all examples for improve mode", () => {
|
||||
const prompt = buildUserPrompt("improve", testText);
|
||||
it('should include all examples for improve mode', () => {
|
||||
const prompt = buildUserPrompt('improve', testText);
|
||||
IMPROVE_EXAMPLES.forEach((example, index) => {
|
||||
expect(prompt).toContain(`Example ${index + 1}:`);
|
||||
expect(prompt).toContain(example.input);
|
||||
});
|
||||
});
|
||||
|
||||
it("should include separator between examples", () => {
|
||||
const prompt = buildUserPrompt("improve", testText);
|
||||
expect(prompt).toContain("---");
|
||||
it('should include separator between examples', () => {
|
||||
const prompt = buildUserPrompt('improve', testText);
|
||||
expect(prompt).toContain('---');
|
||||
});
|
||||
|
||||
it("should work with all enhancement modes", () => {
|
||||
const modes: EnhancementMode[] = ["improve", "technical", "simplify", "acceptance"];
|
||||
it('should work with all enhancement modes', () => {
|
||||
const modes: EnhancementMode[] = ['improve', 'technical', 'simplify', 'acceptance'];
|
||||
modes.forEach((mode) => {
|
||||
const prompt = buildUserPrompt(mode, testText);
|
||||
expect(prompt).toContain(testText);
|
||||
@@ -192,40 +192,40 @@ describe("enhancement-prompts.ts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should preserve the original text exactly", () => {
|
||||
const specialText = "Add feature with special chars: <>&\"'";
|
||||
const prompt = buildUserPrompt("improve", specialText);
|
||||
it('should preserve the original text exactly', () => {
|
||||
const specialText = 'Add feature with special chars: <>&"\'';
|
||||
const prompt = buildUserPrompt('improve', specialText);
|
||||
expect(prompt).toContain(specialText);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isValidEnhancementMode", () => {
|
||||
it("should return true for valid modes", () => {
|
||||
expect(isValidEnhancementMode("improve")).toBe(true);
|
||||
expect(isValidEnhancementMode("technical")).toBe(true);
|
||||
expect(isValidEnhancementMode("simplify")).toBe(true);
|
||||
expect(isValidEnhancementMode("acceptance")).toBe(true);
|
||||
describe('isValidEnhancementMode', () => {
|
||||
it('should return true for valid modes', () => {
|
||||
expect(isValidEnhancementMode('improve')).toBe(true);
|
||||
expect(isValidEnhancementMode('technical')).toBe(true);
|
||||
expect(isValidEnhancementMode('simplify')).toBe(true);
|
||||
expect(isValidEnhancementMode('acceptance')).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for invalid modes", () => {
|
||||
expect(isValidEnhancementMode("invalid")).toBe(false);
|
||||
expect(isValidEnhancementMode("IMPROVE")).toBe(false); // case-sensitive
|
||||
expect(isValidEnhancementMode("")).toBe(false);
|
||||
expect(isValidEnhancementMode("random")).toBe(false);
|
||||
it('should return false for invalid modes', () => {
|
||||
expect(isValidEnhancementMode('invalid')).toBe(false);
|
||||
expect(isValidEnhancementMode('IMPROVE')).toBe(false); // case-sensitive
|
||||
expect(isValidEnhancementMode('')).toBe(false);
|
||||
expect(isValidEnhancementMode('random')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getAvailableEnhancementModes", () => {
|
||||
it("should return all four enhancement modes", () => {
|
||||
describe('getAvailableEnhancementModes', () => {
|
||||
it('should return all four enhancement modes', () => {
|
||||
const modes = getAvailableEnhancementModes();
|
||||
expect(modes).toHaveLength(4);
|
||||
expect(modes).toContain("improve");
|
||||
expect(modes).toContain("technical");
|
||||
expect(modes).toContain("simplify");
|
||||
expect(modes).toContain("acceptance");
|
||||
expect(modes).toContain('improve');
|
||||
expect(modes).toContain('technical');
|
||||
expect(modes).toContain('simplify');
|
||||
expect(modes).toContain('acceptance');
|
||||
});
|
||||
|
||||
it("should return an array", () => {
|
||||
it('should return an array', () => {
|
||||
const modes = getAvailableEnhancementModes();
|
||||
expect(Array.isArray(modes)).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user