(t *testing.T)
| 358 | } |
| 359 | |
| 360 | func TestIsRunnable(t *testing.T) { |
| 361 | tests := []struct { |
| 362 | name string |
| 363 | mdContent string |
| 364 | lockContent string |
| 365 | expected bool |
| 366 | expectError bool |
| 367 | errorMessage string |
| 368 | }{ |
| 369 | { |
| 370 | name: "workflow with schedule trigger", |
| 371 | mdContent: `--- |
| 372 | on: |
| 373 | schedule: |
| 374 | - cron: "0 9 * * *" |
| 375 | --- |
| 376 | # Test Workflow |
| 377 | This workflow runs on schedule.`, |
| 378 | lockContent: `name: "Test Workflow" |
| 379 | on: |
| 380 | schedule: |
| 381 | - cron: "0 9 * * *" |
| 382 | workflow_dispatch: |
| 383 | jobs: |
| 384 | test: |
| 385 | runs-on: ubuntu-latest |
| 386 | steps: |
| 387 | - run: echo "test" |
| 388 | `, |
| 389 | expected: true, |
| 390 | expectError: false, |
| 391 | }, |
| 392 | { |
| 393 | name: "workflow with workflow_dispatch trigger", |
| 394 | mdContent: `--- |
| 395 | on: |
| 396 | workflow_dispatch: |
| 397 | --- |
| 398 | # Manual Workflow |
| 399 | This workflow can be triggered manually.`, |
| 400 | lockContent: `name: "Manual Workflow" |
| 401 | on: |
| 402 | workflow_dispatch: |
| 403 | jobs: |
| 404 | test: |
| 405 | runs-on: ubuntu-latest |
| 406 | steps: |
| 407 | - run: echo "test" |
| 408 | `, |
| 409 | expected: true, |
| 410 | expectError: false, |
| 411 | }, |
| 412 | { |
| 413 | name: "workflow with both schedule and workflow_dispatch", |
| 414 | mdContent: `--- |
| 415 | on: |
| 416 | schedule: |
| 417 | - cron: "0 9 * * 1" |
nothing calls this directly
no test coverage detected