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

Function TestJSONOutput

main_test.go:89–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestJSONOutput(t *testing.T) {
90 output, err := runCodemap("--json", ".")
91 if err != nil {
92 t.Fatalf("JSON output failed: %v", err)
93 }
94
95 // Should be valid JSON
96 var project scanner.Project
97 if err := json.Unmarshal([]byte(output), &project); err != nil {
98 t.Errorf("Output should be valid JSON: %v", err)
99 }
100
101 // Verify structure
102 if project.Root == "" {
103 t.Error("JSON should have root field")
104 }
105 if project.Mode != "tree" {
106 t.Errorf("Expected mode 'tree', got %q", project.Mode)
107 }
108 if len(project.Files) == 0 {
109 t.Error("JSON should have files")
110 }
111
112 // Verify file info structure
113 for _, f := range project.Files {
114 if f.Path == "" {
115 t.Error("File path should not be empty")
116 }
117 }
118}
119
120func TestSubdirectoryPath(t *testing.T) {
121 // Test scanning a subdirectory

Callers

nothing calls this directly

Calls 2

runCodemapFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected