(t *testing.T)
| 186 | } |
| 187 | |
| 188 | func TestJSONFieldValidateSettings(t *testing.T) { |
| 189 | testDefaultFieldIdValidation(t, core.FieldTypeJSON) |
| 190 | testDefaultFieldNameValidation(t, core.FieldTypeJSON) |
| 191 | testDefaultFieldHelpValidation[core.JSONField](t) |
| 192 | |
| 193 | app, _ := tests.NewTestApp() |
| 194 | defer app.Cleanup() |
| 195 | |
| 196 | collection := core.NewBaseCollection("test_collection") |
| 197 | |
| 198 | scenarios := []struct { |
| 199 | name string |
| 200 | field func() *core.JSONField |
| 201 | expectErrors []string |
| 202 | }{ |
| 203 | { |
| 204 | "MaxSize < 0", |
| 205 | func() *core.JSONField { |
| 206 | return &core.JSONField{ |
| 207 | Id: "test", |
| 208 | Name: "test", |
| 209 | MaxSize: -1, |
| 210 | } |
| 211 | }, |
| 212 | []string{"maxSize"}, |
| 213 | }, |
| 214 | { |
| 215 | "MaxSize = 0", |
| 216 | func() *core.JSONField { |
| 217 | return &core.JSONField{ |
| 218 | Id: "test", |
| 219 | Name: "test", |
| 220 | } |
| 221 | }, |
| 222 | []string{}, |
| 223 | }, |
| 224 | { |
| 225 | "MaxSize > 0", |
| 226 | func() *core.JSONField { |
| 227 | return &core.JSONField{ |
| 228 | Id: "test", |
| 229 | Name: "test", |
| 230 | MaxSize: 1, |
| 231 | } |
| 232 | }, |
| 233 | []string{}, |
| 234 | }, |
| 235 | { |
| 236 | "MaxSize > safe json int", |
| 237 | func() *core.JSONField { |
| 238 | return &core.JSONField{ |
| 239 | Id: "test", |
| 240 | Name: "test", |
| 241 | MaxSize: 1 << 53, |
| 242 | } |
| 243 | }, |
| 244 | []string{"maxSize"}, |
| 245 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…