(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestValidateCartesianColorField(t *testing.T) { |
| 172 | rt, id := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{ |
| 173 | Files: metricsViewFiles(), |
| 174 | }) |
| 175 | |
| 176 | // Valid: color as a field config with dimension. |
| 177 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 178 | "c1.yaml": ` |
| 179 | type: component |
| 180 | bar_chart: |
| 181 | metrics_view: mv1 |
| 182 | x: |
| 183 | field: foo |
| 184 | y: |
| 185 | field: y |
| 186 | color: |
| 187 | field: bar |
| 188 | `}) |
| 189 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 190 | testruntime.RequireReconcileState(t, rt, id, 4, 0, 0) |
| 191 | |
| 192 | // Valid: color as a plain string (should be skipped). |
| 193 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 194 | "c1.yaml": ` |
| 195 | type: component |
| 196 | bar_chart: |
| 197 | metrics_view: mv1 |
| 198 | x: |
| 199 | field: foo |
| 200 | y: |
| 201 | field: y |
| 202 | color: "primary" |
| 203 | `}) |
| 204 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 205 | testruntime.RequireReconcileState(t, rt, id, 4, 0, 0) |
| 206 | |
| 207 | // Invalid: color.field is a measure. |
| 208 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 209 | "c1.yaml": ` |
| 210 | type: component |
| 211 | bar_chart: |
| 212 | metrics_view: mv1 |
| 213 | x: |
| 214 | field: foo |
| 215 | y: |
| 216 | field: y |
| 217 | color: |
| 218 | field: y |
| 219 | `}) |
| 220 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 221 | testruntime.RequireReconcileState(t, rt, id, 4, 1, 0) |
| 222 | testruntime.RequireReconcileErrorContains(t, rt, id, runtime.ResourceKindComponent, "c1", "is not a dimension") |
| 223 | } |
| 224 | |
| 225 | func TestValidateCartesianRillMeasures(t *testing.T) { |
| 226 | rt, id := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{ |
nothing calls this directly
no test coverage detected