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

Function TestGetGitHubToolsets

pkg/workflow/github_toolset_test.go:10–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestGetGitHubToolsets(t *testing.T) {
11 tests := []struct {
12 name string
13 input map[string]any
14 expected string
15 }{
16 {
17 name: "No toolsets configured",
18 input: map[string]any{},
19 expected: "context,repos,issues,pull_requests", // defaults to action-friendly toolsets
20 },
21 {
22 name: "Toolsets as array of strings",
23 input: map[string]any{
24 "toolsets": []string{"repos", "issues", "pull_requests"},
25 },
26 expected: "repos,issues,pull_requests",
27 },
28 {
29 name: "Toolsets as array of any",
30 input: map[string]any{
31 "toolsets": []any{"repos", "issues", "actions"},
32 },
33 expected: "repos,issues,actions",
34 },
35 {
36 name: "Special 'all' toolset as array",
37 input: map[string]any{
38 "toolsets": []string{"all"},
39 },
40 expected: "all",
41 },
42 {
43 name: "Special 'default' toolset as array - expands to action-friendly",
44 input: map[string]any{
45 "toolsets": []string{"default"},
46 },
47 expected: "context,repos,issues,pull_requests",
48 },
49 {
50 name: "Default with additional toolsets - expands default to action-friendly",
51 input: map[string]any{
52 "toolsets": []string{"default", "discussions"},
53 },
54 expected: "context,repos,issues,pull_requests,discussions",
55 },
56 {
57 name: "Nil map input returns action-friendly",
58 input: nil,
59 expected: "context,repos,issues,pull_requests",
60 },
61 }
62
63 for _, tt := range tests {
64 t.Run(tt.name, func(t *testing.T) {
65 result := getGitHubToolsets(tt.input)
66 if result != tt.expected {
67 t.Errorf("Expected %q, got %q", tt.expected, result)

Callers

nothing calls this directly

Calls 3

getGitHubToolsetsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected