(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestGetWorkflowInputs(t *testing.T) { |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | lockContent string |
| 16 | expectedCount int |
| 17 | expectedReq map[string]bool // map of input name to required status |
| 18 | }{ |
| 19 | { |
| 20 | name: "workflow with required and optional inputs", |
| 21 | lockContent: `name: "Test Workflow" |
| 22 | on: |
| 23 | workflow_dispatch: |
| 24 | inputs: |
| 25 | issue_url: |
| 26 | description: 'Issue URL' |
| 27 | required: true |
| 28 | type: string |
| 29 | debug_mode: |
| 30 | description: 'Enable debug mode' |
| 31 | required: false |
| 32 | type: boolean |
| 33 | jobs: |
| 34 | test: |
| 35 | runs-on: ubuntu-latest |
| 36 | steps: |
| 37 | - run: echo "test" |
| 38 | `, |
| 39 | expectedCount: 2, |
| 40 | expectedReq: map[string]bool{ |
| 41 | "issue_url": true, |
| 42 | "debug_mode": false, |
| 43 | }, |
| 44 | }, |
| 45 | { |
| 46 | name: "workflow with no inputs", |
| 47 | lockContent: `name: "Test Workflow" |
| 48 | on: |
| 49 | workflow_dispatch: |
| 50 | jobs: |
| 51 | test: |
| 52 | runs-on: ubuntu-latest |
| 53 | steps: |
| 54 | - run: echo "test" |
| 55 | `, |
| 56 | expectedCount: 0, |
| 57 | }, |
| 58 | { |
| 59 | name: "workflow without workflow_dispatch", |
| 60 | lockContent: `name: "Test Workflow" |
| 61 | on: |
| 62 | issues: |
| 63 | types: [opened] |
| 64 | jobs: |
| 65 | test: |
| 66 | runs-on: ubuntu-latest |
| 67 | steps: |
| 68 | - run: echo "test" |
| 69 | `, |
nothing calls this directly
no test coverage detected