MCPcopy
hub / github.com/pocketbase/pocketbase / TestPasswordFieldValidateSettings

Function TestPasswordFieldValidateSettings

core/field_password_test.go:287–449  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

285}
286
287func TestPasswordFieldValidateSettings(t *testing.T) {
288 testDefaultFieldIdValidation(t, core.FieldTypePassword)
289 testDefaultFieldNameValidation(t, core.FieldTypePassword)
290 testDefaultFieldHelpValidation[core.PasswordField](t)
291
292 app, _ := tests.NewTestApp()
293 defer app.Cleanup()
294
295 scenarios := []struct {
296 name string
297 field func(col *core.Collection) *core.PasswordField
298 expectErrors []string
299 }{
300 {
301 "zero minimal",
302 func(col *core.Collection) *core.PasswordField {
303 return &core.PasswordField{
304 Id: "test",
305 Name: "test",
306 }
307 },
308 []string{},
309 },
310 {
311 "invalid pattern",
312 func(col *core.Collection) *core.PasswordField {
313 return &core.PasswordField{
314 Id: "test",
315 Name: "test",
316 Pattern: "(invalid",
317 }
318 },
319 []string{"pattern"},
320 },
321 {
322 "valid pattern",
323 func(col *core.Collection) *core.PasswordField {
324 return &core.PasswordField{
325 Id: "test",
326 Name: "test",
327 Pattern: `\d+`,
328 }
329 },
330 []string{},
331 },
332 {
333 "Min < 0",
334 func(col *core.Collection) *core.PasswordField {
335 return &core.PasswordField{
336 Id: "test",
337 Name: "test",
338 Min: -1,
339 }
340 },
341 []string{"min"},
342 },
343 {
344 "Min > 71",

Callers

nothing calls this directly

Calls 11

CleanupMethod · 0.95
NewTestAppFunction · 0.92
NewBaseCollectionFunction · 0.92
TestValidationErrorsFunction · 0.92
GetByNameMethod · 0.80
SetIdMethod · 0.65
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…