(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func 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: `--- |
| 25 | name: Test Workflow |
| 26 | features: |
| 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: `--- |
| 36 | name: Test Workflow |
| 37 | features: |
| 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: `--- |
| 46 | name: Test Workflow |
| 47 | features: |
| 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 | } |
nothing calls this directly
no test coverage detected