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

Function TestBuildTreeStructure

render/tree_test.go:13–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestBuildTreeStructure(t *testing.T) {
14 files := []scanner.FileInfo{
15 {Path: "main.go", Size: 100},
16 {Path: "go.mod", Size: 50},
17 {Path: "src/app.go", Size: 200},
18 {Path: "src/util/helper.go", Size: 150},
19 {Path: "test/main_test.go", Size: 80},
20 }
21
22 root := buildTreeStructure(files)
23
24 // Root should have children
25 if len(root.children) == 0 {
26 t.Error("Root should have children")
27 }
28
29 // Check main.go exists at root
30 if child, ok := root.children["main.go"]; !ok {
31 t.Error("Expected main.go at root")
32 } else if !child.isFile {
33 t.Error("main.go should be a file")
34 }
35
36 // Check src directory exists
37 if child, ok := root.children["src"]; !ok {
38 t.Error("Expected src directory")
39 } else if child.isFile {
40 t.Error("src should be a directory")
41 }
42}
43
44func TestBuildTreeStructureEmpty(t *testing.T) {
45 files := []scanner.FileInfo{}

Callers

nothing calls this directly

Calls 2

buildTreeStructureFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected