feat(auth): add user profile, phone login, and account deletion
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPublicUserOmitsPhone(t *testing.T) {
|
||||
u := &User{ID: "u1", Email: "user@test.local", Phone: "+15551234567", Name: "Tester"}
|
||||
|
||||
pub, err := json.Marshal(u.Public())
|
||||
if err != nil {
|
||||
t.Fatalf("marshal public: %v", err)
|
||||
}
|
||||
if strings.Contains(string(pub), "phone") || strings.Contains(string(pub), "+15551234567") {
|
||||
t.Fatalf("PublicUser leaks phone: %s", pub)
|
||||
}
|
||||
|
||||
self, err := json.Marshal(u.Self())
|
||||
if err != nil {
|
||||
t.Fatalf("marshal self: %v", err)
|
||||
}
|
||||
if !strings.Contains(string(self), "+15551234567") {
|
||||
t.Fatalf("SelfUser missing phone: %s", self)
|
||||
}
|
||||
if !strings.Contains(string(self), `"phone"`) {
|
||||
t.Fatalf("SelfUser phone not serialized: %s", self)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user