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

Function TestApplyDefaultGitCommandsForSafeOutputs

pkg/workflow/git_commands_test.go:11–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestApplyDefaultGitCommandsForSafeOutputs(t *testing.T) {
12 compiler := NewCompiler()
13 engine := NewClaudeEngine()
14
15 tests := []struct {
16 name string
17 tools map[string]any
18 safeOutputs *SafeOutputsConfig
19 expectGit bool
20 }{
21 {
22 name: "no safe outputs - no git commands",
23 tools: map[string]any{},
24 safeOutputs: nil,
25 expectGit: false,
26 },
27 {
28 name: "create-pull-request enabled - should add git commands",
29 tools: map[string]any{},
30 safeOutputs: &SafeOutputsConfig{
31 CreatePullRequests: &CreatePullRequestsConfig{},
32 },
33 expectGit: true,
34 },
35 {
36 name: "push-to-pull-request-branch enabled - should add git commands",
37 tools: map[string]any{},
38 safeOutputs: &SafeOutputsConfig{
39 PushToPullRequestBranch: &PushToPullRequestBranchConfig{},
40 },
41 expectGit: true,
42 },
43 {
44 name: "only create-issue enabled - no git commands",
45 tools: map[string]any{},
46 safeOutputs: &SafeOutputsConfig{
47 CreateIssues: &CreateIssuesConfig{},
48 },
49 expectGit: false,
50 },
51 {
52 name: "existing bash commands should be preserved",
53 tools: map[string]any{
54 "bash": []any{"echo", "ls"},
55 },
56 safeOutputs: &SafeOutputsConfig{
57 CreatePullRequests: &CreatePullRequestsConfig{},
58 },
59 expectGit: true,
60 },
61 {
62 name: "bash with wildcard should remain wildcard",
63 tools: map[string]any{
64 "bash": []any{":*"},
65 },
66 safeOutputs: &SafeOutputsConfig{
67 CreatePullRequests: &CreatePullRequestsConfig{},
68 },

Callers

nothing calls this directly

Calls 7

applyDefaultToolsMethod · 0.95
NewCompilerFunction · 0.85
NewClaudeEngineFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected