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

Function TestBuildLabelNamesCondition

pkg/workflow/label_names_test.go:74–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestBuildLabelNamesCondition(t *testing.T) {
75 tests := []struct {
76 name string
77 labelNames []string
78 expected string
79 }{
80 {
81 name: "single label name",
82 labelNames: []string{"panel-review"},
83 expected: "github.event.label == null || github.event.label.name == 'panel-review'",
84 },
85 {
86 name: "multiple label names",
87 labelNames: []string{"panel-review", "needs-triage"},
88 expected: "github.event.label == null || github.event.label.name == 'panel-review' || github.event.label.name == 'needs-triage'",
89 },
90 {
91 name: "label name with single quote",
92 labelNames: []string{"can't-repro"},
93 expected: "github.event.label == null || github.event.label.name == 'can''t-repro'",
94 },
95 }
96
97 for _, tt := range tests {
98 t.Run(tt.name, func(t *testing.T) {
99 result := buildLabelNamesCondition(tt.labelNames)
100 assert.Equal(t, tt.expected, result, "buildLabelNamesCondition should return expected condition")
101 })
102 }
103}
104
105// TestLabelNamesPreActivationFilter verifies that on.labels generates a job-level
106// if: condition on the pre_activation job that skips the workflow when the triggering

Callers

nothing calls this directly

Calls 2

buildLabelNamesConditionFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected