(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func 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 |
nothing calls this directly
no test coverage detected