MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestDiscoverAll

Function TestDiscoverAll

internal/aiagentconfig/discover_test.go:37–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestDiscoverAll(t *testing.T) {
38 tests := []struct {
39 name string
40 files []string
41 expected map[string][]DiscoveredFile
42 }{
43 {
44 name: "no config files",
45 files: []string{"main.go", "README.md"},
46 expected: map[string][]DiscoveredFile{},
47 },
48 {
49 name: "claude only",
50 files: []string{"CLAUDE.md", ".claude/settings.json"},
51 expected: map[string][]DiscoveredFile{
52 "claude": {
53 {Path: ".claude/settings.json", Kind: ConfigFileKindConfiguration},
54 {Path: "CLAUDE.md", Kind: ConfigFileKindInstruction},
55 },
56 },
57 },
58 {
59 name: "cursor only",
60 files: []string{".cursor/rules/coding.md", ".cursor/agents/test.md"},
61 expected: map[string][]DiscoveredFile{
62 "cursor": {
63 {Path: ".cursor/agents/test.md", Kind: ConfigFileKindAgent},
64 {Path: ".cursor/rules/coding.md", Kind: ConfigFileKindInstruction},
65 },
66 },
67 },
68 {
69 name: "cursor mdc extension",
70 files: []string{
71 ".cursor/rules/react.mdc",
72 ".cursor/rules/api.md",
73 },
74 expected: map[string][]DiscoveredFile{
75 "cursor": {
76 {Path: ".cursor/rules/api.md", Kind: ConfigFileKindInstruction},
77 {Path: ".cursor/rules/react.mdc", Kind: ConfigFileKindInstruction},
78 },
79 },
80 },
81 {
82 name: "cursor nested rules",
83 files: []string{
84 ".cursor/rules/frontend/components.md",
85 ".cursor/rules/backend/api.mdc",
86 },
87 expected: map[string][]DiscoveredFile{
88 "cursor": {
89 {Path: ".cursor/rules/backend/api.mdc", Kind: ConfigFileKindInstruction},
90 {Path: ".cursor/rules/frontend/components.md", Kind: ConfigFileKindInstruction},
91 },
92 },
93 },
94 {

Callers

nothing calls this directly

Calls 3

createFilesFunction · 0.85
DiscoverAllFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected