(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func 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 := `--- |
| 125 | on: |
| 126 | workflow_dispatch: |
| 127 | |
| 128 | timeout-minutes: 30 |
| 129 | |
| 130 | permissions: |
| 131 | contents: read |
| 132 | --- |
| 133 | |
| 134 | # Test Workflow |
| 135 | |
| 136 | This 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 | |
| 167 | func TestFixCommand_NetworkFirewallMigration(t *testing.T) { |
| 168 | // Create a temporary directory for test files |
nothing calls this directly
no test coverage detected