(t *testing.T)
| 285 | } |
| 286 | |
| 287 | func 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", |
nothing calls this directly
no test coverage detected
searching dependent graphs…