Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ describe("language-lesson", () => {
expect(concepts).toContain("middleware pattern");
});

it("does not flag type guards from the 'is' substring in common words", () => {
const plainNode: GraphNode = {
id: "function:math:add",
type: "function",
name: "add",
filePath: "src/math/add.ts",
summary: "This function adds two numbers",
tags: ["utility"],
complexity: "simple",
};
const concepts = detectLanguageConcepts(plainNode, "typescript");
expect(concepts).not.toContain("type guards");
});

it("returns empty for nodes with no detectable concepts", () => {
const plainNode: GraphNode = {
id: "file:src/config.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const BASE_CONCEPT_PATTERNS: Record<string, string[]> = {
"listener",
],
"singleton": ["singleton", "instance", "shared client"],
"type guards": ["type guard", "is", "narrowing", "discriminated union"],
"type guards": ["type guard", "narrowing", "discriminated union"],
"higher-order functions": [
"callback",
"factory",
Expand Down
Loading