(t *testing.T)
| 520 | } |
| 521 | |
| 522 | func TestValidateIssueLabelsColor(t *testing.T) { |
| 523 | tests := []struct { |
| 524 | name string |
| 525 | labels []*v1pb.Label |
| 526 | wantErr bool |
| 527 | }{ |
| 528 | { |
| 529 | name: "missing color", |
| 530 | labels: []*v1pb.Label{ |
| 531 | {Value: "review"}, |
| 532 | }, |
| 533 | }, |
| 534 | { |
| 535 | name: "opaque color", |
| 536 | labels: []*v1pb.Label{ |
| 537 | {Value: "review", Color: &colorpb.Color{Red: 0.1, Green: 0.2, Blue: 0.3}}, |
| 538 | }, |
| 539 | }, |
| 540 | { |
| 541 | name: "explicit alpha one", |
| 542 | labels: []*v1pb.Label{ |
| 543 | {Value: "review", Color: &colorpb.Color{Red: 0.1, Green: 0.2, Blue: 0.3, Alpha: wrapperspb.Float(1)}}, |
| 544 | }, |
| 545 | }, |
| 546 | { |
| 547 | name: "channel out of range", |
| 548 | labels: []*v1pb.Label{ |
| 549 | {Value: "review", Color: &colorpb.Color{Red: 1.1, Green: 0.2, Blue: 0.3}}, |
| 550 | }, |
| 551 | wantErr: true, |
| 552 | }, |
| 553 | { |
| 554 | name: "transparent color", |
| 555 | labels: []*v1pb.Label{ |
| 556 | {Value: "review", Color: &colorpb.Color{Red: 0.1, Green: 0.2, Blue: 0.3, Alpha: wrapperspb.Float(0.5)}}, |
| 557 | }, |
| 558 | wantErr: true, |
| 559 | }, |
| 560 | } |
| 561 | |
| 562 | for _, tc := range tests { |
| 563 | t.Run(tc.name, func(t *testing.T) { |
| 564 | err := validateIssueLabels(tc.labels) |
| 565 | if tc.wantErr { |
| 566 | require.Error(t, err) |
| 567 | return |
| 568 | } |
| 569 | require.NoError(t, err) |
| 570 | }) |
| 571 | } |
| 572 | } |
nothing calls this directly
no test coverage detected