MCPcopy Create free account
hub / github.com/github/gh-aw / TestArgsField

Function TestArgsField

pkg/workflow/args_field_test.go:12–224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestArgsField(t *testing.T) {
13 // Test GitHub tool args extraction
14 t.Run("GitHub args field extraction", func(t *testing.T) {
15 // Test "args" field with []any
16 githubTool := map[string]any{
17 "allowed": []any{"create_issue"},
18 "args": []any{"--verbose", "--debug"},
19 }
20 result := getGitHubCustomArgs(githubTool)
21 if len(result) != 2 {
22 t.Errorf("Expected 2 args, got %d", len(result))
23 }
24 if result[0] != "--verbose" || result[1] != "--debug" {
25 t.Errorf("Expected [--verbose --debug], got %v", result)
26 }
27
28 // Test "args" field with []string
29 githubToolString := map[string]any{
30 "allowed": []any{"create_issue"},
31 "args": []string{"--custom-flag"},
32 }
33 result = getGitHubCustomArgs(githubToolString)
34 if len(result) != 1 {
35 t.Errorf("Expected 1 arg, got %d", len(result))
36 }
37 if result[0] != "--custom-flag" {
38 t.Errorf("Expected [--custom-flag], got %v", result)
39 }
40
41 // Test no args field (default behavior)
42 githubToolDefault := map[string]any{
43 "allowed": []any{"create_issue"},
44 }
45 result = getGitHubCustomArgs(githubToolDefault)
46 if result != nil {
47 t.Errorf("Expected nil args, got %v", result)
48 }
49 })
50
51 // Test Playwright tool args extraction
52 t.Run("Playwright args field extraction", func(t *testing.T) {
53 // Test "args" field with []any
54 playwrightTool := map[string]any{
55 "args": []any{"--browser", "firefox"},
56 }
57 playwrightConfig := parsePlaywrightTool(playwrightTool)
58 result := getPlaywrightCustomArgs(playwrightConfig)
59 if len(result) != 2 {
60 t.Errorf("Expected 2 args, got %d", len(result))
61 }
62 if result[0] != "--browser" || result[1] != "firefox" {
63 t.Errorf("Expected [--browser firefox], got %v", result)
64 }
65
66 // Test "args" field with []string
67 playwrightToolString := map[string]any{
68 "args": []string{"--headless"},
69 }

Callers

nothing calls this directly

Calls 6

ExtractMCPConfigurationsFunction · 0.92
getGitHubCustomArgsFunction · 0.85
parsePlaywrightToolFunction · 0.85
getPlaywrightCustomArgsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected