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

Function TestByokCopilotFeatureRemovalCodemod

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45

Tested by

no test coverage detected