TestSpec_PublicAPI_GetObjectiveLabels validates that GetObjectiveLabels returns the subset of issue labels that have defined objective values, preserving original order.
(t *testing.T)
| 160 | // returns the subset of issue labels that have defined objective values, |
| 161 | // preserving original order. |
| 162 | func TestSpec_PublicAPI_GetObjectiveLabels(t *testing.T) { |
| 163 | om := &github.ObjectiveMapping{ |
| 164 | LabelToValue: map[string]int{ |
| 165 | "bug": github.ObjectiveValueBug, |
| 166 | "high-priority": github.ObjectiveValueHighPriority, |
| 167 | }, |
| 168 | } |
| 169 | |
| 170 | t.Run("returns only labels with defined values", func(t *testing.T) { |
| 171 | got := om.GetObjectiveLabels([]string{"bug", "good first issue"}) |
| 172 | assert.Equal(t, []string{"bug"}, got, |
| 173 | "only labels with defined objective values should be returned") |
| 174 | }) |
| 175 | |
| 176 | t.Run("preserves original input order", func(t *testing.T) { |
| 177 | got := om.GetObjectiveLabels([]string{"high-priority", "unknown", "bug"}) |
| 178 | assert.Equal(t, []string{"high-priority", "bug"}, got, |
| 179 | "returned labels should preserve their original order") |
| 180 | }) |
| 181 | |
| 182 | t.Run("no matching labels returns empty", func(t *testing.T) { |
| 183 | got := om.GetObjectiveLabels([]string{"unknown"}) |
| 184 | assert.Empty(t, got, "no matching labels should yield an empty result") |
| 185 | }) |
| 186 | } |
| 187 | |
| 188 | // TestSpec_PublicAPI_ValidateLabelExists validates that ValidateLabelExists |
| 189 | // reports whether a label has a defined objective value. |
nothing calls this directly
no test coverage detected