(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestWorkflowRunsSpinnerMessage(t *testing.T) { |
| 284 | tests := []struct { |
| 285 | name string |
| 286 | opts ListWorkflowRunsOptions |
| 287 | want string |
| 288 | }{ |
| 289 | { |
| 290 | name: "without target count", |
| 291 | opts: ListWorkflowRunsOptions{}, |
| 292 | want: "Fetching workflow runs from GitHub...", |
| 293 | }, |
| 294 | { |
| 295 | name: "with target count", |
| 296 | opts: ListWorkflowRunsOptions{ |
| 297 | ProcessedCount: 3, |
| 298 | TargetCount: 10, |
| 299 | }, |
| 300 | want: "Fetching workflow runs from GitHub... (3 / 10)", |
| 301 | }, |
| 302 | { |
| 303 | name: "processed equals target", |
| 304 | opts: ListWorkflowRunsOptions{ |
| 305 | ProcessedCount: 10, |
| 306 | TargetCount: 10, |
| 307 | }, |
| 308 | want: "Fetching workflow runs from GitHub... (10 / 10)", |
| 309 | }, |
| 310 | { |
| 311 | name: "processed exceeds target", |
| 312 | opts: ListWorkflowRunsOptions{ |
| 313 | ProcessedCount: 12, |
| 314 | TargetCount: 10, |
| 315 | }, |
| 316 | want: "Fetching workflow runs from GitHub... (12 / 10)", |
| 317 | }, |
| 318 | { |
| 319 | name: "processed without target", |
| 320 | opts: ListWorkflowRunsOptions{ |
| 321 | ProcessedCount: 4, |
| 322 | }, |
| 323 | want: "Fetching workflow runs from GitHub...", |
| 324 | }, |
| 325 | } |
| 326 | |
| 327 | for _, tt := range tests { |
| 328 | t.Run(tt.name, func(t *testing.T) { |
| 329 | msg := workflowRunsSpinnerMessage(tt.opts) |
| 330 | assert.Equal(t, tt.want, msg) |
| 331 | }) |
| 332 | } |
| 333 | } |
nothing calls this directly
no test coverage detected