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

Function TestGrepToolRemovalCodemod_BasicRemoval

pkg/cli/codemod_grep_tool_test.go:23–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestGrepToolRemovalCodemod_BasicRemoval(t *testing.T) {
24 codemod := getGrepToolRemovalCodemod()
25
26 content := `---
27on: workflow_dispatch
28tools:
29 bash: ["echo", "ls"]
30 grep: true
31 github:
32permissions:
33 contents: read
34---
35
36# Test Workflow`
37
38 frontmatter := map[string]any{
39 "on": "workflow_dispatch",
40 "tools": map[string]any{
41 "bash": []any{"echo", "ls"},
42 "grep": true,
43 "github": nil,
44 },
45 "permissions": map[string]any{
46 "contents": "read",
47 },
48 }
49
50 result, applied, err := codemod.Apply(content, frontmatter)
51
52 require.NoError(t, err, "Apply should not return an error")
53 assert.True(t, applied, "Codemod should report changes")
54 assert.NotContains(t, result, "grep:", "Result should not contain grep field")
55 assert.Contains(t, result, "bash:", "Result should preserve bash tool")
56 assert.Contains(t, result, "github:", "Result should preserve github tool")
57}
58
59func TestGrepToolRemovalCodemod_NoToolsBlock(t *testing.T) {
60 codemod := getGrepToolRemovalCodemod()

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected