MCPcopy Create free account
hub / github.com/diillson/chatcli / TestProcessDirectory

Function TestProcessDirectory

utils/file_utils_test.go:52–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestProcessDirectory(t *testing.T) {
53 tempDir, err := os.MkdirTemp("", "test-processdir-*")
54 require.NoError(t, err)
55 defer os.RemoveAll(tempDir)
56
57 createTestDirStructure(t, tempDir)
58 logger, _ := zap.NewDevelopment()
59 options := DefaultDirectoryScanOptions(logger)
60
61 files, err := ProcessDirectory(context.Background(), tempDir, options)
62 require.NoError(t, err)
63
64 // Deve encontrar 3 arquivos: main.go, button.js, README.md
65 assert.Len(t, files, 3)
66
67 foundPaths := make(map[string]bool)
68 for _, f := range files {
69 // Normalizar o path para a comparação
70 relPath, err := filepath.Rel(tempDir, f.Path)
71 require.NoError(t, err)
72 foundPaths[relPath] = true
73 }
74
75 assert.True(t, foundPaths["main.go"])
76 assert.True(t, foundPaths[filepath.Join("src/components/button.js")])
77 assert.True(t, foundPaths["README.md"])
78}
79
80func TestProcessDirectory_WithLimits(t *testing.T) {
81 tempDir, err := os.MkdirTemp("", "test-limits-*")

Callers

nothing calls this directly

Calls 4

createTestDirStructureFunction · 0.85
ProcessDirectoryFunction · 0.85
LenMethod · 0.45

Tested by

no test coverage detected