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

Function TestFixCommand_NoChangesNeeded

pkg/cli/fix_command_test.go:118–165  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func TestFixCommand_NoChangesNeeded(t *testing.T) {
119 // Create a temporary directory for test files
120 tmpDir := t.TempDir()
121 workflowFile := filepath.Join(tmpDir, "test-workflow.md")
122
123 // Create a workflow with no deprecated fields
124 content := `---
125on:
126 workflow_dispatch:
127
128timeout-minutes: 30
129
130permissions:
131 contents: read
132---
133
134# Test Workflow
135
136This is a test workflow.
137`
138
139 if err := os.WriteFile(workflowFile, []byte(content), 0644); err != nil {
140 t.Fatalf("Failed to create test file: %v", err)
141 }
142
143 // Run all codemods
144 codemods := GetAllCodemods()
145
146 // Process the file
147 fixed, _, err := processWorkflowFileWithInfo(workflowFile, codemods, false, false)
148 if err != nil {
149 t.Fatalf("Failed to process workflow file: %v", err)
150 }
151
152 if fixed {
153 t.Error("Expected no changes, but file was marked as fixed")
154 }
155
156 // Read the content to verify it's unchanged
157 updatedContent, err := os.ReadFile(workflowFile)
158 if err != nil {
159 t.Fatalf("Failed to read file: %v", err)
160 }
161
162 if string(updatedContent) != content {
163 t.Error("Expected content to be unchanged")
164 }
165}
166
167func TestFixCommand_NetworkFirewallMigration(t *testing.T) {
168 // Create a temporary directory for test files

Callers

nothing calls this directly

Calls 3

GetAllCodemodsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected