package identity import "testing" func TestHashPasswordAndVerifyPassword(t *testing.T) { t.Parallel() hash, err := HashPassword("correct horse battery staple") if err != nil { t.Fatal(err) } if !VerifyPassword("correct horse battery staple", hash) { t.Fatal("VerifyPassword() = false, want true") } if VerifyPassword("incorrect password", hash) { t.Fatal("VerifyPassword() = true for incorrect password") } } func TestHashPasswordRejectsShortPassword(t *testing.T) { t.Parallel() if _, err := HashPassword("short"); err == nil { t.Fatal("HashPassword() error = nil, want length error") } }