Add phone registration with SMS verification and regenerate Swagger docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
704606b3f5
commit
5e3c46da83
17 files changed
+1008
-20
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package auth
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizePhone(t *testing.T) {
|
||||
tests := []struct {
|
||||
in, want string
|
||||
}{
|
||||
{"+993 61 92 92 48", "+993 61 92 92 48"},
|
||||
{"+99361929248", "+993 61 92 92 48"},
|
||||
{"99361929248", "+993 61 92 92 48"},
|
||||
{"61929248", "+993 61 92 92 48"},
|
||||
{"8 61929248", "+993 61 92 92 48"},
|
||||
{"61 92 92 48", "+993 61 92 92 48"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got, err := NormalizePhone(tt.in)
|
||||
if err != nil {
|
||||
t.Fatalf("NormalizePhone(%q) unexpected error: %v", tt.in, err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Errorf("NormalizePhone(%q) = %q, want %q", tt.in, got, tt.want)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := NormalizePhone("123"); err != ErrInvalidPhone {
|
||||
t.Errorf("NormalizePhone(123) error = %v, want ErrInvalidPhone", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user