MCPcopy Create free account
hub / github.com/rilldata/rill / TestValidateCartesianMultiField

Function TestValidateCartesianMultiField

runtime/canvas/component_test.go:130–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestValidateCartesianMultiField(t *testing.T) {
131 rt, id := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{
132 Files: metricsViewFiles(),
133 })
134
135 // Valid multi-field y.
136 testruntime.PutFiles(t, rt, id, map[string]string{
137 "c1.yaml": `
138type: component
139line_chart:
140 metrics_view: mv1
141 x:
142 field: foo
143 y:
144 field: y
145 fields:
146 - y
147 - z
148`})
149 testruntime.ReconcileParserAndWait(t, rt, id)
150 testruntime.RequireReconcileState(t, rt, id, 4, 0, 0)
151
152 // Invalid: one of the y.fields is a dimension.
153 testruntime.PutFiles(t, rt, id, map[string]string{
154 "c1.yaml": `
155type: component
156line_chart:
157 metrics_view: mv1
158 x:
159 field: foo
160 y:
161 field: y
162 fields:
163 - y
164 - foo
165`})
166 testruntime.ReconcileParserAndWait(t, rt, id)
167 testruntime.RequireReconcileState(t, rt, id, 4, 1, 0)
168 testruntime.RequireReconcileErrorContains(t, rt, id, runtime.ResourceKindComponent, "c1", "is not a measure")
169}
170
171func TestValidateCartesianColorField(t *testing.T) {
172 rt, id := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{

Callers

nothing calls this directly

Calls 6

NewInstanceWithOptionsFunction · 0.92
PutFilesFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
metricsViewFilesFunction · 0.85

Tested by

no test coverage detected