MCPcopy Index your code
hub / github.com/coder/coder / TestAllowedBehaviorToolNames

Function TestAllowedBehaviorToolNames

coderd/x/chatd/chatd_internal_test.go:587–619  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

585}
586
587func TestAllowedBehaviorToolNames(t *testing.T) {
588 t.Parallel()
589
590 makeTools := func(names ...string) []fantasy.AgentTool {
591 tools := make([]fantasy.AgentTool, 0, len(names))
592 for _, name := range names {
593 tools = append(tools, newTestAgentTool(name))
594 }
595 return tools
596 }
597
598 allTools := makeTools("read_file", "custom_tool", "spawn_agent")
599 exploreMode := database.NullChatMode{
600 ChatMode: database.ChatModeExplore,
601 Valid: true,
602 }
603
604 t.Run("DefaultModeReturnsAllTools", func(t *testing.T) {
605 t.Parallel()
606 require.Equal(t, []string{"read_file", "custom_tool", "spawn_agent"}, allowedBehaviorToolNames(
607 allTools,
608 database.NullChatMode{},
609 ))
610 })
611
612 t.Run("ExploreModeUsesExploreAllowlist", func(t *testing.T) {
613 t.Parallel()
614 require.Equal(t, []string{"read_file"}, allowedBehaviorToolNames(
615 allTools,
616 exploreMode,
617 ))
618 })
619}
620
621func TestStopAfterPlanTools(t *testing.T) {
622 t.Parallel()

Callers

nothing calls this directly

Calls 4

newTestAgentToolFunction · 0.85
allowedBehaviorToolNamesFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected