(t *testing.T)
| 822 | } |
| 823 | |
| 824 | func TestFixCommand_GrepToolRemoval_NoGrep(t *testing.T) { |
| 825 | // Create a temporary directory for test files |
| 826 | tmpDir := t.TempDir() |
| 827 | workflowFile := filepath.Join(tmpDir, "test-workflow.md") |
| 828 | |
| 829 | // Create a workflow without grep field |
| 830 | content := `--- |
| 831 | on: |
| 832 | workflow_dispatch: |
| 833 | |
| 834 | tools: |
| 835 | bash: ["echo", "ls"] |
| 836 | github: |
| 837 | |
| 838 | permissions: |
| 839 | contents: read |
| 840 | --- |
| 841 | |
| 842 | # Test Workflow |
| 843 | |
| 844 | This workflow doesn't have grep. |
| 845 | ` |
| 846 | |
| 847 | if err := os.WriteFile(workflowFile, []byte(content), 0644); err != nil { |
| 848 | t.Fatalf("Failed to create test file: %v", err) |
| 849 | } |
| 850 | |
| 851 | // Get the grep removal codemod |
| 852 | grepCodemod := getCodemodByID("grep-tool-removal") |
| 853 | if grepCodemod == nil { |
| 854 | t.Fatal("grep-tool-removal codemod not found") |
| 855 | } |
| 856 | |
| 857 | // Process the file |
| 858 | fixed, _, err := processWorkflowFileWithInfo(workflowFile, []Codemod{*grepCodemod}, true, false) |
| 859 | if err != nil { |
| 860 | t.Fatalf("Failed to process workflow file: %v", err) |
| 861 | } |
| 862 | |
| 863 | if fixed { |
| 864 | t.Error("Expected file to not be modified when grep is not present") |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | func TestFixCommand_SandboxFalseToAgentFalseMigration(t *testing.T) { |
| 869 | // Create a temporary directory for test files |
nothing calls this directly
no test coverage detected