(t *testing.T)
| 230 | } |
| 231 | |
| 232 | func Test_ViewRun(t *testing.T) { |
| 233 | tests := []struct { |
| 234 | name string |
| 235 | opts *ViewOptions |
| 236 | repoName string |
| 237 | stdoutTTY bool |
| 238 | wantOut string |
| 239 | wantStderr string |
| 240 | wantErr bool |
| 241 | }{ |
| 242 | { |
| 243 | name: "nontty", |
| 244 | wantOut: heredoc.Doc(` |
| 245 | name: OWNER/REPO |
| 246 | description: social distancing |
| 247 | -- |
| 248 | # truly cool readme check it out |
| 249 | `), |
| 250 | }, |
| 251 | { |
| 252 | name: "url arg", |
| 253 | repoName: "jill/valentine", |
| 254 | opts: &ViewOptions{ |
| 255 | RepoArg: "https://github.com/jill/valentine", |
| 256 | }, |
| 257 | stdoutTTY: true, |
| 258 | wantOut: heredoc.Doc(` |
| 259 | jill/valentine |
| 260 | social distancing |
| 261 | |
| 262 | |
| 263 | # truly cool readme check it out |
| 264 | |
| 265 | |
| 266 | |
| 267 | View this repository on GitHub: https://github.com/jill/valentine |
| 268 | `), |
| 269 | }, |
| 270 | { |
| 271 | name: "name arg", |
| 272 | repoName: "jill/valentine", |
| 273 | opts: &ViewOptions{ |
| 274 | RepoArg: "jill/valentine", |
| 275 | }, |
| 276 | stdoutTTY: true, |
| 277 | wantOut: heredoc.Doc(` |
| 278 | jill/valentine |
| 279 | social distancing |
| 280 | |
| 281 | |
| 282 | # truly cool readme check it out |
| 283 | |
| 284 | |
| 285 | |
| 286 | View this repository on GitHub: https://github.com/jill/valentine |
| 287 | `), |
| 288 | }, |
| 289 | { |
nothing calls this directly
no test coverage detected