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

Function TestDIFCProxyToIntegrityProxyCodemod

pkg/cli/codemod_difc_proxy_test.go:12–276  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestDIFCProxyToIntegrityProxyCodemod(t *testing.T) {
13 codemod := getDIFCProxyToIntegrityProxyCodemod()
14
15 t.Run("removes features.difc-proxy: true (no-op since proxy is now default)", func(t *testing.T) {
16 content := `---
17engine: copilot
18features:
19 difc-proxy: true
20tools:
21 github:
22 min-integrity: approved
23---
24
25# Test Workflow
26`
27 frontmatter := map[string]any{
28 "engine": "copilot",
29 "features": map[string]any{
30 "difc-proxy": true,
31 },
32 "tools": map[string]any{
33 "github": map[string]any{
34 "min-integrity": "approved",
35 },
36 },
37 }
38
39 result, applied, err := codemod.Apply(content, frontmatter)
40 require.NoError(t, err, "Should not error")
41 assert.True(t, applied, "Should have applied the codemod")
42 assert.NotContains(t, result, "difc-proxy", "Should remove features.difc-proxy")
43 assert.NotContains(t, result, "integrity-proxy", "Should not add integrity-proxy when was true")
44 assert.Contains(t, result, "min-integrity: approved", "Should preserve min-integrity")
45 })
46
47 t.Run("removes features.difc-proxy: false and adds tools.github.integrity-proxy: false", func(t *testing.T) {
48 content := `---
49engine: copilot
50features:
51 difc-proxy: false
52tools:
53 github:
54 min-integrity: approved
55---
56
57# Test Workflow
58`
59 frontmatter := map[string]any{
60 "engine": "copilot",
61 "features": map[string]any{
62 "difc-proxy": false,
63 },
64 "tools": map[string]any{
65 "github": map[string]any{
66 "min-integrity": "approved",
67 },
68 },
69 }

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected