(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestNewFieldRemovalCodemod_FieldKeyMissing(t *testing.T) { |
| 85 | codemod := newFieldRemovalCodemod(baseFieldRemovalConfig()) |
| 86 | |
| 87 | content := `--- |
| 88 | on: workflow_dispatch |
| 89 | parent: |
| 90 | other: value |
| 91 | --- |
| 92 | |
| 93 | # Test` |
| 94 | |
| 95 | frontmatter := map[string]any{ |
| 96 | "on": "workflow_dispatch", |
| 97 | "parent": map[string]any{ |
| 98 | "other": "value", |
| 99 | }, |
| 100 | } |
| 101 | |
| 102 | result, applied, err := codemod.Apply(content, frontmatter) |
| 103 | |
| 104 | require.NoError(t, err, "Apply should not return an error when child field is missing") |
| 105 | assert.False(t, applied, "Codemod should not report changes when child field is missing") |
| 106 | assert.Equal(t, content, result, "Content should remain unchanged") |
| 107 | } |
| 108 | |
| 109 | func TestNewFieldRemovalCodemod_SuccessfulRemoval(t *testing.T) { |
| 110 | codemod := newFieldRemovalCodemod(baseFieldRemovalConfig()) |
nothing calls this directly
no test coverage detected