MCPcopy
hub / github.com/wavetermdev/waveterm / TestParseReadDirInput

Function TestParseReadDirInput

pkg/aiusechat/tools_readdir_test.go:238–273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

236}
237
238func TestParseReadDirInput(t *testing.T) {
239 // Test valid input
240 input := map[string]any{
241 "path": "/tmp/test",
242 }
243
244 params, err := parseReadDirInput(input)
245 if err != nil {
246 t.Fatalf("parseReadDirInput failed on valid input: %v", err)
247 }
248
249 if params.Path != "/tmp/test" {
250 t.Errorf("Expected path '/tmp/test', got %q", params.Path)
251 }
252
253 if *params.MaxEntries != ReadDirDefaultMaxEntries {
254 t.Errorf("Expected default max_entries %d, got %d", ReadDirDefaultMaxEntries, *params.MaxEntries)
255 }
256
257 // Test missing path
258 input = map[string]any{}
259 _, err = parseReadDirInput(input)
260 if err == nil {
261 t.Error("Expected error for missing path, got nil")
262 }
263
264 // Test invalid max_entries
265 input = map[string]any{
266 "path": "/tmp/test",
267 "max_entries": 0,
268 }
269 _, err = parseReadDirInput(input)
270 if err == nil {
271 t.Error("Expected error for max_entries < 1, got nil")
272 }
273}
274
275func TestGetReadDirToolDefinition(t *testing.T) {
276 toolDef := GetReadDirToolDefinition()

Callers

nothing calls this directly

Calls 2

parseReadDirInputFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected