(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestMissingDataConfigParsing(t *testing.T) { |
| 119 | tests := []struct { |
| 120 | name string |
| 121 | configData map[string]any |
| 122 | expectNil bool |
| 123 | expectMax int |
| 124 | expectIssue *string |
| 125 | expectTitle string |
| 126 | expectLabels []string |
| 127 | }{ |
| 128 | { |
| 129 | name: "Default config with nil value", |
| 130 | configData: map[string]any{ |
| 131 | "missing-data": nil, |
| 132 | }, |
| 133 | expectNil: false, |
| 134 | expectMax: 0, |
| 135 | expectIssue: strPtr("false"), |
| 136 | expectTitle: "[missing data]", |
| 137 | expectLabels: []string{}, |
| 138 | }, |
| 139 | { |
| 140 | name: "Config with create-issue disabled", |
| 141 | configData: map[string]any{ |
| 142 | "missing-data": map[string]any{ |
| 143 | "create-issue": false, |
| 144 | }, |
| 145 | }, |
| 146 | expectNil: false, |
| 147 | expectMax: 0, |
| 148 | expectIssue: strPtr("false"), |
| 149 | expectTitle: "[missing data]", |
| 150 | expectLabels: []string{}, |
| 151 | }, |
| 152 | { |
| 153 | name: "Config with create-issue as expression", |
| 154 | configData: map[string]any{ |
| 155 | "missing-data": map[string]any{ |
| 156 | "create-issue": "${{ inputs.create-missing-data-issue }}", |
| 157 | }, |
| 158 | }, |
| 159 | expectNil: false, |
| 160 | expectMax: 0, |
| 161 | expectIssue: strPtr("${{ inputs.create-missing-data-issue }}"), |
| 162 | expectTitle: "[missing data]", |
| 163 | expectLabels: []string{}, |
| 164 | }, |
| 165 | { |
| 166 | name: "Config with custom title and labels", |
| 167 | configData: map[string]any{ |
| 168 | "missing-data": map[string]any{ |
| 169 | "title-prefix": "[data needed]", |
| 170 | "labels": []any{"data", "blocked"}, |
| 171 | "max": 10, |
| 172 | }, |
| 173 | }, |
| 174 | expectNil: false, |
| 175 | expectMax: 10, |
nothing calls this directly
no test coverage detected