MCPcopy Index your code
hub / github.com/dnote/dnote / TestValidatePassword

Function TestValidatePassword

pkg/server/app/users_test.go:28–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestValidatePassword(t *testing.T) {
29 testCases := []struct {
30 name string
31 password string
32 wantErr error
33 }{
34 {
35 name: "valid password",
36 password: "password123",
37 wantErr: nil,
38 },
39 {
40 name: "valid password exactly 8 chars",
41 password: "12345678",
42 wantErr: nil,
43 },
44 {
45 name: "password too short",
46 password: "1234567",
47 wantErr: ErrPasswordTooShort,
48 },
49 {
50 name: "empty password",
51 password: "",
52 wantErr: ErrPasswordTooShort,
53 },
54 }
55
56 for _, tc := range testCases {
57 t.Run(tc.name, func(t *testing.T) {
58 err := validatePassword(tc.password)
59 assert.Equal(t, err, tc.wantErr, "error mismatch")
60 })
61 }
62}
63
64func TestCreateUser_ProValue(t *testing.T) {
65 db := testutils.InitMemoryDB(t)

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
validatePasswordFunction · 0.85

Tested by

no test coverage detected