MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestScanFilesIgnoresDirs

Function TestScanFilesIgnoresDirs

scanner/walker_test.go:78–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestScanFilesIgnoresDirs(t *testing.T) {
79 tmpDir := t.TempDir()
80
81 // Create files including one in an ignored directory
82 if err := os.MkdirAll(filepath.Join(tmpDir, "node_modules"), 0755); err != nil {
83 t.Fatal(err)
84 }
85 if err := os.WriteFile(filepath.Join(tmpDir, "node_modules", "package.json"), []byte("{}"), 0644); err != nil {
86 t.Fatal(err)
87 }
88 if err := os.WriteFile(filepath.Join(tmpDir, "main.go"), []byte("package main"), 0644); err != nil {
89 t.Fatal(err)
90 }
91
92 result, err := ScanFiles(tmpDir, nil, nil, nil)
93 if err != nil {
94 t.Fatalf("ScanFiles failed: %v", err)
95 }
96
97 // Should only have main.go, not node_modules/package.json
98 if len(result) != 1 {
99 t.Errorf("Expected 1 file (main.go), got %d files", len(result))
100 }
101
102 if len(result) > 0 && result[0].Path != "main.go" {
103 t.Errorf("Expected main.go, got %s", result[0].Path)
104 }
105}
106
107func TestScanFilesExtensions(t *testing.T) {
108 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 1

ScanFilesFunction · 0.85

Tested by

no test coverage detected