(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestTrialModeIssueDetection(t *testing.T) { |
| 12 | compiler := NewCompiler() |
| 13 | |
| 14 | testCases := []struct { |
| 15 | name string |
| 16 | onSection string |
| 17 | expected bool |
| 18 | }{ |
| 19 | { |
| 20 | name: "Has issues trigger", |
| 21 | onSection: `on: |
| 22 | issues: |
| 23 | types: [opened, edited]`, |
| 24 | expected: true, |
| 25 | }, |
| 26 | { |
| 27 | name: "Has issue trigger (singular)", |
| 28 | onSection: `on: |
| 29 | issue: |
| 30 | types: [opened]`, |
| 31 | expected: true, |
| 32 | }, |
| 33 | { |
| 34 | name: "Has issue_comment trigger", |
| 35 | onSection: `on: |
| 36 | issue_comment: |
| 37 | types: [created]`, |
| 38 | expected: true, |
| 39 | }, |
| 40 | { |
| 41 | name: "No issue triggers", |
| 42 | onSection: `on: |
| 43 | push: |
| 44 | branches: [main] |
| 45 | pull_request:`, |
| 46 | expected: false, |
| 47 | }, |
| 48 | { |
| 49 | name: "Mixed triggers with issues", |
| 50 | onSection: `on: |
| 51 | push: |
| 52 | branches: [main] |
| 53 | issues: |
| 54 | types: [opened] |
| 55 | workflow_dispatch:`, |
| 56 | expected: true, |
| 57 | }, |
| 58 | { |
| 59 | name: "Empty on section", |
| 60 | onSection: "", |
| 61 | expected: false, |
| 62 | }, |
| 63 | } |
| 64 | |
| 65 | for _, tc := range testCases { |
| 66 | t.Run(tc.name, func(t *testing.T) { |
| 67 | result := compiler.hasIssueTrigger(tc.onSection) |
| 68 | if result != tc.expected { |
nothing calls this directly
no test coverage detected