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

Function TestFixCommand_GrepToolRemoval_NoGrep

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

Source from the content-addressed store, hash-verified

822}
823
824func 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 := `---
831on:
832 workflow_dispatch:
833
834tools:
835 bash: ["echo", "ls"]
836 github:
837
838permissions:
839 contents: read
840---
841
842# Test Workflow
843
844This 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
868func TestFixCommand_SandboxFalseToAgentFalseMigration(t *testing.T) {
869 // Create a temporary directory for test files

Callers

nothing calls this directly

Calls 3

getCodemodByIDFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected