Files
shanxia2.0/backend/tests/test_wechat_mini_auth_phone.py
T

27 lines
738 B
Python

from app.services.wechat_mini_auth import normalize_cn_mobile, phones_match
def test_normalize_strips_plus86():
assert normalize_cn_mobile("+8613800138000") == "13800138000"
def test_normalize_strips_86_prefix_13_digits():
assert normalize_cn_mobile("8613800138000") == "13800138000"
def test_phones_match_equal():
assert phones_match("13800138000", "13800138000") is True
def test_phones_match_normalizes():
assert phones_match("13800138000", "+8613800138000") is True
def test_phones_match_mismatch():
assert phones_match("13800138000", "13900139000") is False
def test_phones_match_empty_fails():
assert phones_match("", "13800138000") is False
assert phones_match(None, "13800138000") is False