Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/cli/codemod_mcp_mode_to_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
)

func TestMCPModeToTypeCodemod(t *testing.T) {
t.Parallel()
codemod := getMCPModeToTypeCodemod()

t.Run("renames mode to type in custom MCP servers", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
tools:
Expand Down Expand Up @@ -49,6 +51,7 @@ mcp-servers:
})

t.Run("does not modify workflows without mcp-servers", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
tools:
Expand All @@ -75,6 +78,7 @@ tools:
})

t.Run("does not modify GitHub tool mode field", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
tools:
Expand Down Expand Up @@ -113,6 +117,7 @@ mcp-servers:
})

t.Run("handles multiple MCP servers with mode", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
mcp-servers:
Expand Down Expand Up @@ -151,6 +156,7 @@ mcp-servers:
})

t.Run("does not modify when no mode field exists", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
mcp-servers:
Expand Down Expand Up @@ -179,6 +185,7 @@ mcp-servers:
})

t.Run("preserves comments and formatting", func(t *testing.T) {
t.Parallel()
content := `---
engine: copilot
mcp-servers:
Expand Down
22 changes: 22 additions & 0 deletions pkg/cli/codemod_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetPermissionsReadCodemod(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

assert.Equal(t, "permissions-read-to-read-all", codemod.ID)
Expand All @@ -20,6 +21,7 @@ func TestGetPermissionsReadCodemod(t *testing.T) {
}

func TestPermissionsReadCodemod_Read(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -43,6 +45,7 @@ permissions: read
}

func TestPermissionsReadCodemod_Write(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -66,6 +69,7 @@ permissions: write
}

func TestPermissionsReadCodemod_NoChange_ReadAll(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -88,6 +92,7 @@ permissions: read-all
}

func TestPermissionsReadCodemod_NoChange_WriteAll(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -110,6 +115,7 @@ permissions: write-all
}

func TestPermissionsReadCodemod_NoChange_MapFormat(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand Down Expand Up @@ -137,6 +143,7 @@ permissions:
}

func TestPermissionsReadCodemod_NoPermissions(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -159,6 +166,7 @@ timeout-minutes: 30
}

func TestPermissionsReadCodemod_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getExpandPermissionsShorthandCodemod()

content := `---
Expand All @@ -184,6 +192,7 @@ This workflow needs permissions.`
}

func TestGetWritePermissionsCodemod(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

assert.Equal(t, "write-permissions-to-read-migration", codemod.ID)
Expand All @@ -194,6 +203,7 @@ func TestGetWritePermissionsCodemod(t *testing.T) {
}

func TestWritePermissionsCodemod_ShorthandWriteAll(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand All @@ -217,6 +227,7 @@ permissions: write-all
}

func TestWritePermissionsCodemod_ShorthandWrite(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand All @@ -240,6 +251,7 @@ permissions: write
}

func TestWritePermissionsCodemod_MapFormat(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -269,6 +281,7 @@ permissions:
}

func TestWritePermissionsCodemod_MultipleWritePermissions(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -300,6 +313,7 @@ permissions:
}

func TestWritePermissionsCodemod_NoPermissionsField(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand All @@ -322,6 +336,7 @@ timeout-minutes: 30
}

func TestWritePermissionsCodemod_OnlyReadPermissions(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -349,6 +364,7 @@ permissions:
}

func TestWritePermissionsCodemod_PreservesIndentation(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -377,6 +393,7 @@ permissions:
}

func TestWritePermissionsCodemod_PreservesComments(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -405,6 +422,7 @@ permissions:
}

func TestWritePermissionsCodemod_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand All @@ -430,6 +448,7 @@ This workflow needs permissions.`
}

func TestWritePermissionsCodemod_SkipsIdToken(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -459,6 +478,7 @@ permissions:
}

func TestWritePermissionsCodemod_SkipsCopilotRequests(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -488,6 +508,7 @@ permissions:
}

func TestWritePermissionsCodemod_MixedWithIdToken(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down Expand Up @@ -521,6 +542,7 @@ permissions:
}

func TestWritePermissionsCodemod_MixedWithCopilotRequests(t *testing.T) {
t.Parallel()
codemod := getMigrateWritePermissionsToReadCodemod()

content := `---
Expand Down
Loading