aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-08-31 00:04:23 -0400
committerBobby <[email protected]>2022-08-31 00:04:23 -0400
commitc6344afd77b8bf5baeb67fee8270ca24c555ec6c (patch)
treea0e7151ec44c05969ae95ee6c969980160577d1c /tests
parentd909b5d264b7244dbf7d74970e4b34be9181bb9b (diff)
downloadedify-c6344afd77b8bf5baeb67fee8270ca24c555ec6c.tar.xz
edify-c6344afd77b8bf5baeb67fee8270ca24c555ec6c.zip
Added Phone Number Validation
Diffstat (limited to 'tests')
-rw-r--r--tests/test_phone.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_phone.py b/tests/test_phone.py
new file mode 100644
index 0000000..6a26af5
--- /dev/null
+++ b/tests/test_phone.py
@@ -0,0 +1,24 @@
+from edify.library import phone_number
+
+def test():
+ phones = {
+ "1234567890": True,
+ "123 456 7890": True,
+ "123-456-7890": True,
+ "123.456.7890": True,
+ "123 456 7890": True,
+ "+1 (123) 456-7890": True,
+ "+1 (123) 456 7890": True,
+ "+1 (123) 456-7890": True,
+ "+102 (123) 456-7890": True,
+ "+91 (123) 456-7890": True,
+ "90122121": True,
+ "12345678901": True,
+ "+1 (124) 232": True,
+ "+1 (123) 45-890": True,
+ "+1 (1) 456-7890": True,
+ "9012": False,
+ "+1 (615) 243-": False
+ }
+ for phone, expectation in phones.items():
+ assert phone_number(phone) == expectation