| 641 | } |
| 642 | |
| 643 | func TestCheckHost(t *testing.T) { |
| 644 | tests := []struct { |
| 645 | name string |
| 646 | host string |
| 647 | wantErr string |
| 648 | }{ |
| 649 | { |
| 650 | name: "github.com", |
| 651 | host: "github.com", |
| 652 | }, |
| 653 | { |
| 654 | name: "a ghe.com host", |
| 655 | host: "monas-cafe.ghe.com", |
| 656 | }, |
| 657 | { |
| 658 | name: "GitHub Enterprise Server", |
| 659 | host: "ghes.monas-cafe.example", |
| 660 | wantErr: "issue artifacts are not supported on GitHub Enterprise Server", |
| 661 | }, |
| 662 | } |
| 663 | |
| 664 | for _, tt := range tests { |
| 665 | t.Run(tt.name, func(t *testing.T) { |
| 666 | err := CheckHost(tt.host) |
| 667 | |
| 668 | if tt.wantErr != "" { |
| 669 | require.EqualError(t, err, tt.wantErr) |
| 670 | return |
| 671 | } |
| 672 | require.NoError(t, err) |
| 673 | }) |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | func TestCheckIssue(t *testing.T) { |
| 678 | tests := []struct { |