(t *testing.T)
| 379 | } |
| 380 | |
| 381 | func TestTextFieldValidateSettings(t *testing.T) { |
| 382 | testDefaultFieldIdValidation(t, core.FieldTypeText) |
| 383 | testDefaultFieldNameValidation(t, core.FieldTypeText) |
| 384 | testDefaultFieldHelpValidation[core.TextField](t) |
| 385 | |
| 386 | app, _ := tests.NewTestApp() |
| 387 | defer app.Cleanup() |
| 388 | |
| 389 | scenarios := []struct { |
| 390 | name string |
| 391 | field func() *core.TextField |
| 392 | expectErrors []string |
| 393 | }{ |
| 394 | { |
| 395 | "zero minimal", |
| 396 | func() *core.TextField { |
| 397 | return &core.TextField{ |
| 398 | Id: "test", |
| 399 | Name: "test", |
| 400 | } |
| 401 | }, |
| 402 | []string{}, |
| 403 | }, |
| 404 | { |
| 405 | "primaryKey without required", |
| 406 | func() *core.TextField { |
| 407 | return &core.TextField{ |
| 408 | Id: "test", |
| 409 | Name: "id", |
| 410 | PrimaryKey: true, |
| 411 | Pattern: `\d+`, |
| 412 | } |
| 413 | }, |
| 414 | []string{"required"}, |
| 415 | }, |
| 416 | { |
| 417 | "primaryKey without pattern", |
| 418 | func() *core.TextField { |
| 419 | return &core.TextField{ |
| 420 | Id: "test", |
| 421 | Name: "id", |
| 422 | PrimaryKey: true, |
| 423 | Required: true, |
| 424 | } |
| 425 | }, |
| 426 | []string{"pattern"}, |
| 427 | }, |
| 428 | { |
| 429 | "primaryKey with hidden", |
| 430 | func() *core.TextField { |
| 431 | return &core.TextField{ |
| 432 | Id: "test", |
| 433 | Name: "id", |
| 434 | Required: true, |
| 435 | PrimaryKey: true, |
| 436 | Hidden: true, |
| 437 | Pattern: `\d+`, |
| 438 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…