-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinter.test.ts
More file actions
46 lines (40 loc) · 1.75 KB
/
Copy pathlinter.test.ts
File metadata and controls
46 lines (40 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { describe, it, expect } from "vitest";
import { PromptLinter } from "../src/linters/prompt-linter.js";
import { ProjectContext } from "../src/detectors/project-scout.js";
describe("PromptLinter", () => {
const mockCtx: ProjectContext = {
language: "TypeScript",
framework: "React",
testing: "Vitest",
isTypeScript: true,
architecturalPatterns: ["Modern Component-Based Architecture (React/Vue style)"],
learnedPatterns: [],
relevantSnippets: [],
activeIntents: []
};
it("should detect missing testing strategy if not mentioned in prompt", () => {
const prompt = "Build a user login system";
const gaps = PromptLinter.lint(prompt, mockCtx);
expect(gaps.some(g => g.id === "testing")).toBe(true);
});
it("should NOT detect testing gap if prompt mentions tests", () => {
const prompt = "Build a login system with unit tests";
const gaps = PromptLinter.lint(prompt, mockCtx);
expect(gaps.some(g => g.id === "testing")).toBe(false);
});
it("should detect missing security requirements for data-sensitive prompts", () => {
const prompt = "Create a database connection and user registration";
const gaps = PromptLinter.lint(prompt, mockCtx);
expect(gaps.some(g => g.id === "security")).toBe(true);
});
it("should detect missing architectural guidance for complex features", () => {
const prompt = "Refactor the entire auth system";
const gaps = PromptLinter.lint(prompt, mockCtx);
expect(gaps.some(g => g.id === "architecture")).toBe(true);
});
it("should detect missing documentation requirements", () => {
const prompt = "Create a new API endpoint";
const gaps = PromptLinter.lint(prompt, mockCtx);
expect(gaps.some(g => g.id === "documentation")).toBe(true);
});
});