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

Function TestInferWorkflowPathFromDisplayName

pkg/cli/logs_json_test.go:918–964  ·  view source on GitHub ↗

TestInferWorkflowPathFromDisplayName verifies that display names are correctly slugified into conventional lock-file paths.

(t *testing.T)

Source from the content-addressed store, hash-verified

916// TestInferWorkflowPathFromDisplayName verifies that display names are correctly
917// slugified into conventional lock-file paths.
918func TestInferWorkflowPathFromDisplayName(t *testing.T) {
919 tests := []struct {
920 name string
921 displayName string
922 want string
923 }{
924 {
925 name: "simple display name with spaces",
926 displayName: "Auto-Triage Issues",
927 want: ".github/workflows/auto-triage-issues.lock.yml",
928 },
929 {
930 name: "display name with mixed case and spaces",
931 displayName: "CI Failure Doctor",
932 want: ".github/workflows/ci-failure-doctor.lock.yml",
933 },
934 {
935 name: "already kebab-case slug",
936 displayName: "weekly-research",
937 want: ".github/workflows/weekly-research.lock.yml",
938 },
939 {
940 name: "display name with slash",
941 displayName: "CI/CD Pipeline",
942 want: ".github/workflows/ci-cd-pipeline.lock.yml",
943 },
944 {
945 name: "display name with colon",
946 displayName: "Deploy: Production",
947 want: ".github/workflows/deploy-production.lock.yml",
948 },
949 {
950 name: "empty display name",
951 displayName: "",
952 want: "",
953 },
954 }
955
956 for _, tt := range tests {
957 t.Run(tt.name, func(t *testing.T) {
958 got := inferWorkflowPathFromDisplayName(tt.displayName)
959 if got != tt.want {
960 t.Errorf("inferWorkflowPathFromDisplayName(%q) = %q, want %q", tt.displayName, got, tt.want)
961 }
962 })
963 }
964}
965
966// TestBuildLogsDataInfersWorkflowPathFromAwInfo verifies that buildLogsData falls back
967// to inferring workflow_path from aw_info.json when the GitHub API returned an empty path.

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected