(t *testing.T)
| 664 | } |
| 665 | |
| 666 | func TestIsIssueWorkflow(t *testing.T) { |
| 667 | tests := []struct { |
| 668 | name string |
| 669 | on string |
| 670 | expected bool |
| 671 | }{ |
| 672 | { |
| 673 | name: "Issues workflow should be identified", |
| 674 | on: `on: |
| 675 | issues: |
| 676 | types: [opened, edited]`, |
| 677 | expected: true, |
| 678 | }, |
| 679 | { |
| 680 | name: "Issue comment workflow should be identified", |
| 681 | on: `on: |
| 682 | issue_comment: |
| 683 | types: [created]`, |
| 684 | expected: true, |
| 685 | }, |
| 686 | { |
| 687 | name: "Pull request workflow should not be identified as issue workflow", |
| 688 | on: `on: |
| 689 | pull_request: |
| 690 | types: [opened, synchronize]`, |
| 691 | expected: false, |
| 692 | }, |
| 693 | { |
| 694 | name: "Schedule workflow should not be identified as issue workflow", |
| 695 | on: `on: |
| 696 | schedule: |
| 697 | - cron: "0 9 * * 1"`, |
| 698 | expected: false, |
| 699 | }, |
| 700 | { |
| 701 | name: "Mixed workflow with issues should be identified", |
| 702 | on: `on: |
| 703 | issues: |
| 704 | types: [opened, edited] |
| 705 | push: |
| 706 | branches: [main]`, |
| 707 | expected: true, |
| 708 | }, |
| 709 | { |
| 710 | name: "Mixed workflow with issue_comment should be identified", |
| 711 | on: `on: |
| 712 | issue_comment: |
| 713 | types: [created] |
| 714 | schedule: |
| 715 | - cron: "0 9 * * 1"`, |
| 716 | expected: true, |
| 717 | }, |
| 718 | } |
| 719 | |
| 720 | for _, tt := range tests { |
| 721 | t.Run(tt.name, func(t *testing.T) { |
| 722 | result := isIssueWorkflow(tt.on) |
| 723 | if result != tt.expected { |
nothing calls this directly
no test coverage detected