(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestGrepToolRemovalCodemod_NoToolsBlock(t *testing.T) { |
| 60 | codemod := getGrepToolRemovalCodemod() |
| 61 | |
| 62 | content := `--- |
| 63 | on: workflow_dispatch |
| 64 | permissions: |
| 65 | contents: read |
| 66 | --- |
| 67 | |
| 68 | # Test Workflow` |
| 69 | |
| 70 | frontmatter := map[string]any{ |
| 71 | "on": "workflow_dispatch", |
| 72 | "permissions": map[string]any{ |
| 73 | "contents": "read", |
| 74 | }, |
| 75 | } |
| 76 | |
| 77 | result, applied, err := codemod.Apply(content, frontmatter) |
| 78 | |
| 79 | require.NoError(t, err, "Apply should not return an error") |
| 80 | assert.False(t, applied, "Codemod should not report changes when tools block doesn't exist") |
| 81 | assert.Equal(t, content, result, "Content should remain unchanged") |
| 82 | } |
| 83 | |
| 84 | func TestGrepToolRemovalCodemod_NoGrepField(t *testing.T) { |
| 85 | codemod := getGrepToolRemovalCodemod() |
nothing calls this directly
no test coverage detected