| 873 | } |
| 874 | |
| 875 | func TestCheckType(t *testing.T) { |
| 876 | tests := []struct { |
| 877 | name string |
| 878 | artifactType string |
| 879 | wantErr string |
| 880 | }{ |
| 881 | { |
| 882 | name: "generic", |
| 883 | artifactType: "generic", |
| 884 | }, |
| 885 | { |
| 886 | name: "plan", |
| 887 | artifactType: "plan", |
| 888 | }, |
| 889 | { |
| 890 | name: "link", |
| 891 | artifactType: "link", |
| 892 | }, |
| 893 | { |
| 894 | name: "embedded_html", |
| 895 | artifactType: "embedded_html", |
| 896 | }, |
| 897 | { |
| 898 | name: "a type gh doesn't know", |
| 899 | artifactType: "bad-type", |
| 900 | wantErr: `artifact 7 has type "bad-type", which this version of gh doesn't support; upgrade gh`, |
| 901 | }, |
| 902 | { |
| 903 | name: "an empty type", |
| 904 | artifactType: "", |
| 905 | wantErr: `artifact 7 has type "", which this version of gh doesn't support; upgrade gh`, |
| 906 | }, |
| 907 | } |
| 908 | |
| 909 | for _, tt := range tests { |
| 910 | t.Run(tt.name, func(t *testing.T) { |
| 911 | err := CheckType(client.Artifact{Number: 7, Type: tt.artifactType, Name: "Espresso checklist"}) |
| 912 | |
| 913 | if tt.wantErr != "" { |
| 914 | require.EqualError(t, err, tt.wantErr) |
| 915 | return |
| 916 | } |
| 917 | require.NoError(t, err) |
| 918 | }) |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | func TestSupportsAttachments(t *testing.T) { |
| 923 | tests := []struct { |