(t *testing.T)
| 667 | } |
| 668 | |
| 669 | func TestEliminateDuplicates(t *testing.T) { |
| 670 | tests := []struct { |
| 671 | name string |
| 672 | checkContexts []api.CheckContext |
| 673 | want []api.CheckContext |
| 674 | }{ |
| 675 | { |
| 676 | name: "duplicate CheckRun (lint)", |
| 677 | checkContexts: []api.CheckContext{ |
| 678 | { |
| 679 | TypeName: "CheckRun", |
| 680 | Name: "build (ubuntu-latest)", |
| 681 | Status: "COMPLETED", |
| 682 | Conclusion: "SUCCESS", |
| 683 | StartedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 684 | CompletedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 685 | DetailsURL: "https://github.com/cli/cli/runs/1", |
| 686 | }, |
| 687 | { |
| 688 | TypeName: "CheckRun", |
| 689 | Name: "lint", |
| 690 | Status: "COMPLETED", |
| 691 | Conclusion: "FAILURE", |
| 692 | StartedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 693 | CompletedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 694 | DetailsURL: "https://github.com/cli/cli/runs/2", |
| 695 | }, |
| 696 | { |
| 697 | TypeName: "CheckRun", |
| 698 | Name: "lint", |
| 699 | Status: "COMPLETED", |
| 700 | Conclusion: "SUCCESS", |
| 701 | StartedAt: time.Date(2022, 2, 2, 2, 2, 2, 2, time.UTC), |
| 702 | CompletedAt: time.Date(2022, 2, 2, 2, 2, 2, 2, time.UTC), |
| 703 | DetailsURL: "https://github.com/cli/cli/runs/3", |
| 704 | }, |
| 705 | }, |
| 706 | want: []api.CheckContext{ |
| 707 | { |
| 708 | TypeName: "CheckRun", |
| 709 | Name: "lint", |
| 710 | Status: "COMPLETED", |
| 711 | Conclusion: "SUCCESS", |
| 712 | StartedAt: time.Date(2022, 2, 2, 2, 2, 2, 2, time.UTC), |
| 713 | CompletedAt: time.Date(2022, 2, 2, 2, 2, 2, 2, time.UTC), |
| 714 | DetailsURL: "https://github.com/cli/cli/runs/3", |
| 715 | }, |
| 716 | { |
| 717 | TypeName: "CheckRun", |
| 718 | Name: "build (ubuntu-latest)", |
| 719 | Status: "COMPLETED", |
| 720 | Conclusion: "SUCCESS", |
| 721 | StartedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 722 | CompletedAt: time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC), |
| 723 | DetailsURL: "https://github.com/cli/cli/runs/1", |
| 724 | }, |
| 725 | }, |
| 726 | }, |
nothing calls this directly
no test coverage detected