(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestGrepToolRemovalCodemod_BasicRemoval(t *testing.T) { |
| 24 | codemod := getGrepToolRemovalCodemod() |
| 25 | |
| 26 | content := `--- |
| 27 | on: workflow_dispatch |
| 28 | tools: |
| 29 | bash: ["echo", "ls"] |
| 30 | grep: true |
| 31 | github: |
| 32 | permissions: |
| 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 | |
| 59 | func TestGrepToolRemovalCodemod_NoToolsBlock(t *testing.T) { |
| 60 | codemod := getGrepToolRemovalCodemod() |
nothing calls this directly
no test coverage detected