MCPcopy
hub / github.com/pocketbase/pocketbase / TestFileFieldValidateSettings

Function TestFileFieldValidateSettings

core/field_file_test.go:443–601  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

441}
442
443func TestFileFieldValidateSettings(t *testing.T) {
444 testDefaultFieldIdValidation(t, core.FieldTypeFile)
445 testDefaultFieldNameValidation(t, core.FieldTypeFile)
446 testDefaultFieldHelpValidation[core.FileField](t)
447
448 app, _ := tests.NewTestApp()
449 defer app.Cleanup()
450
451 scenarios := []struct {
452 name string
453 field func() *core.FileField
454 expectErrors []string
455 }{
456 {
457 "zero minimal",
458 func() *core.FileField {
459 return &core.FileField{
460 Id: "test",
461 Name: "test",
462 }
463 },
464 []string{},
465 },
466 {
467 "0x0 thumb",
468 func() *core.FileField {
469 return &core.FileField{
470 Id: "test",
471 Name: "test",
472 MaxSelect: 1,
473 Thumbs: []string{"100x200", "0x0"},
474 }
475 },
476 []string{"thumbs"},
477 },
478 {
479 "0x0t thumb",
480 func() *core.FileField {
481 return &core.FileField{
482 Id: "test",
483 Name: "test",
484 MaxSize: 1,
485 MaxSelect: 1,
486 Thumbs: []string{"100x200", "0x0t"},
487 }
488 },
489 []string{"thumbs"},
490 },
491 {
492 "0x0b thumb",
493 func() *core.FileField {
494 return &core.FileField{
495 Id: "test",
496 Name: "test",
497 MaxSize: 1,
498 MaxSelect: 1,
499 Thumbs: []string{"100x200", "0x0b"},
500 }

Callers

nothing calls this directly

Calls 9

CleanupMethod · 0.95
NewTestAppFunction · 0.92
NewBaseCollectionFunction · 0.92
TestValidationErrorsFunction · 0.92
ValidateSettingsMethod · 0.65
RunMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…