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

Function TestNewFieldRemovalCodemod_FieldKeyMissing

pkg/cli/codemod_factory_test.go:84–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestNewFieldRemovalCodemod_FieldKeyMissing(t *testing.T) {
85 codemod := newFieldRemovalCodemod(baseFieldRemovalConfig())
86
87 content := `---
88on: workflow_dispatch
89parent:
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
109func TestNewFieldRemovalCodemod_SuccessfulRemoval(t *testing.T) {
110 codemod := newFieldRemovalCodemod(baseFieldRemovalConfig())

Callers

nothing calls this directly

Calls 2

newFieldRemovalCodemodFunction · 0.85
baseFieldRemovalConfigFunction · 0.85

Tested by

no test coverage detected