(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestStatusRun(t *testing.T) { |
| 88 | tests := []struct { |
| 89 | name string |
| 90 | httpStubs func(*httpmock.Registry) |
| 91 | opts *StatusOptions |
| 92 | wantOut string |
| 93 | wantErrMsg string |
| 94 | }{ |
| 95 | { |
| 96 | name: "nothing", |
| 97 | httpStubs: func(reg *httpmock.Registry) { |
| 98 | reg.Register( |
| 99 | httpmock.GraphQL("UserCurrent"), |
| 100 | httpmock.StringResponse(`{"data": {"viewer": {"login": "jillvalentine"}}}`)) |
| 101 | reg.Register( |
| 102 | httpmock.GraphQL("AssignedSearch"), |
| 103 | httpmock.StringResponse(`{"data": { "assignments": {"nodes": [] }, "reviewRequested": {"nodes": []}}}`)) |
| 104 | reg.Register( |
| 105 | httpmock.REST("GET", "notifications"), |
| 106 | httpmock.StringResponse(`[]`)) |
| 107 | reg.Register( |
| 108 | httpmock.REST("GET", "users/jillvalentine/received_events"), |
| 109 | httpmock.StringResponse(`[]`)) |
| 110 | }, |
| 111 | opts: &StatusOptions{}, |
| 112 | wantOut: "Assigned Issues │ Assigned Pull Requests \nNothing here ^_^ │ Nothing here ^_^ \n │ \nReview Requests │ Mentions \nNothing here ^_^ │ Nothing here ^_^ \n │ \nRepository Activity\nNothing here ^_^\n\n", |
| 113 | }, |
| 114 | { |
| 115 | name: "something", |
| 116 | httpStubs: func(reg *httpmock.Registry) { |
| 117 | reg.Register( |
| 118 | httpmock.GraphQL("UserCurrent"), |
| 119 | httpmock.StringResponse(`{"data": {"viewer": {"login": "jillvalentine"}}}`)) |
| 120 | reg.Register( |
| 121 | httpmock.REST("GET", "repos/rpd/todo/issues/110"), |
| 122 | httpmock.StringResponse(`{"body":"hello @jillvalentine how are you"}`)) |
| 123 | reg.Register( |
| 124 | httpmock.REST("GET", "repos/rpd/todo/issues/4113"), |
| 125 | httpmock.StringResponse(`{"body":"this is a comment"}`)) |
| 126 | reg.Register( |
| 127 | httpmock.REST("GET", "repos/cli/cli/issues/1096"), |
| 128 | httpmock.StringResponse(`{"body":"@jillvalentine hi"}`)) |
| 129 | reg.Register( |
| 130 | httpmock.REST("GET", "repos/rpd/todo/issues/comments/1065"), |
| 131 | httpmock.StringResponse(`{"body":"not a real mention"}`)) |
| 132 | reg.Register( |
| 133 | httpmock.REST("GET", "repos/vilmibm/gh-screensaver/issues/comments/10"), |
| 134 | httpmock.StringResponse(`{"body":"a message for @jillvalentine"}`)) |
| 135 | reg.Register( |
| 136 | httpmock.GraphQL("AssignedSearch"), |
| 137 | httpmock.FileResponse("./fixtures/search.json")) |
| 138 | reg.Register( |
| 139 | httpmock.REST("GET", "notifications"), |
| 140 | httpmock.FileResponse("./fixtures/notifications.json")) |
| 141 | reg.Register( |
| 142 | httpmock.REST("GET", "users/jillvalentine/received_events"), |
| 143 | httpmock.FileResponse("./fixtures/events.json")) |
| 144 | }, |
nothing calls this directly
no test coverage detected