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

Function TestInlineAgentsFeatureRemovalCodemod

pkg/cli/codemod_inline_agents_test.go:13–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestInlineAgentsFeatureRemovalCodemod(t *testing.T) {
14 codemod := getInlineAgentsFeatureRemovalCodemod()
15 assert.Equal(t, "1.0.0", codemod.IntroducedIn)
16
17 tests := []struct {
18 name string
19 input string
20 expectApply bool
21 }{
22 {
23 name: "removes inline-agents when true",
24 input: `---
25name: Test Workflow
26features:
27 inline-agents: true
28 mcp-gateway: true
29---
30# Test workflow`,
31 expectApply: true,
32 },
33 {
34 name: "removes inline-agents when false",
35 input: `---
36name: Test Workflow
37features:
38 inline-agents: false
39---
40# Test workflow`,
41 expectApply: true,
42 },
43 {
44 name: "does not modify when inline-agents is absent",
45 input: `---
46name: Test Workflow
47features:
48 mcp-gateway: true
49---
50# Test workflow`,
51 expectApply: false,
52 },
53 }
54
55 for _, tt := range tests {
56 t.Run(tt.name, func(t *testing.T) {
57 result, err := parser.ExtractFrontmatterFromContent(tt.input)
58 require.NoError(t, err, "Failed to parse test input frontmatter")
59
60 output, applied, err := codemod.Apply(tt.input, result.Frontmatter)
61 require.NoError(t, err, "Codemod apply should not error")
62 assert.Equal(t, tt.expectApply, applied, "Applied status mismatch")
63
64 if tt.expectApply {
65 assert.NotContains(t, output, "inline-agents:", "Codemod should remove deprecated inline-agents flag")
66 } else {
67 assert.Equal(t, tt.input, output, "Output should be unchanged when codemod does not apply")
68 }
69 })
70 }

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45

Tested by

no test coverage detected