mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-02 07:25:26 +08:00
34 lines
895 B
Go
34 lines
895 B
Go
package client
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeMobileForLogin_ChinaWithPlus86(t *testing.T) {
|
|
mobile, areaCode := normalizeMobileForLogin("+8613800138000")
|
|
if mobile != "13800138000" {
|
|
t.Fatalf("unexpected mobile: %q", mobile)
|
|
}
|
|
if areaCode != nil {
|
|
t.Fatalf("expected nil areaCode, got %#v", areaCode)
|
|
}
|
|
}
|
|
|
|
func TestNormalizeMobileForLogin_ChinaWith86Prefix(t *testing.T) {
|
|
mobile, areaCode := normalizeMobileForLogin("8613800138000")
|
|
if mobile != "13800138000" {
|
|
t.Fatalf("unexpected mobile: %q", mobile)
|
|
}
|
|
if areaCode != nil {
|
|
t.Fatalf("expected nil areaCode, got %#v", areaCode)
|
|
}
|
|
}
|
|
|
|
func TestNormalizeMobileForLogin_KeepPlainDigits(t *testing.T) {
|
|
mobile, areaCode := normalizeMobileForLogin("13800138000")
|
|
if mobile != "13800138000" {
|
|
t.Fatalf("unexpected mobile: %q", mobile)
|
|
}
|
|
if areaCode != nil {
|
|
t.Fatalf("expected nil areaCode, got %#v", areaCode)
|
|
}
|
|
}
|