(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func Test_listURLWithQuery(t *testing.T) { |
| 18 | trueBool := true |
| 19 | falseBool := false |
| 20 | |
| 21 | type args struct { |
| 22 | listURL string |
| 23 | options FilterOptions |
| 24 | advancedIssueSearchSyntax bool |
| 25 | } |
| 26 | |
| 27 | tests := []struct { |
| 28 | name string |
| 29 | args args |
| 30 | want string |
| 31 | wantErr bool |
| 32 | }{ |
| 33 | { |
| 34 | name: "blank", |
| 35 | args: args{ |
| 36 | listURL: "https://example.com/path?a=b", |
| 37 | options: FilterOptions{ |
| 38 | Entity: "issue", |
| 39 | State: "open", |
| 40 | }, |
| 41 | }, |
| 42 | want: "https://example.com/path?a=b&q=state%3Aopen+type%3Aissue", |
| 43 | wantErr: false, |
| 44 | }, |
| 45 | { |
| 46 | name: "blank, advanced search", |
| 47 | args: args{ |
| 48 | listURL: "https://example.com/path?a=b", |
| 49 | options: FilterOptions{ |
| 50 | Entity: "issue", |
| 51 | State: "open", |
| 52 | }, |
| 53 | advancedIssueSearchSyntax: true, |
| 54 | }, |
| 55 | want: "https://example.com/path?a=b&q=state%3Aopen+type%3Aissue", |
| 56 | wantErr: false, |
| 57 | }, |
| 58 | { |
| 59 | name: "draft", |
| 60 | args: args{ |
| 61 | listURL: "https://example.com/path", |
| 62 | options: FilterOptions{ |
| 63 | Entity: "pr", |
| 64 | State: "open", |
| 65 | Draft: &trueBool, |
| 66 | }, |
| 67 | }, |
| 68 | want: "https://example.com/path?q=draft%3Atrue+state%3Aopen+type%3Apr", |
| 69 | wantErr: false, |
| 70 | }, |
| 71 | { |
| 72 | name: "draft, advanced search", |
| 73 | args: args{ |
| 74 | listURL: "https://example.com/path", |
nothing calls this directly
no test coverage detected