Skip to content

Commit

Permalink
chore: add test for SamanTel phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsm74 committed Dec 30, 2023
1 parent 817e888 commit ef5d534
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_phone_number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ void main() {
expect(number5?.operator?.name, 'ایرانسل');
expect(number5?.type, SimCardType.both);

final number6 = getPhoneNumberDetail('09990880440');

expect(number6?.base, 'کشوری');
expect(number6?.operator?.name, 'سامانتل');
expect(number6?.type, SimCardType.both);

expect(getPhoneNumberDetail('09022002580')?.provinces?.length ?? 0, 0);

/// Should return null, because it's not an iranian phone number
Expand All @@ -52,6 +58,10 @@ void main() {
expect(phoneNumberValidator('00989022002580'), true);
expect(phoneNumberValidator('9022002580'), true);

expect(phoneNumberValidator('9992002580'), true);
expect(phoneNumberValidator('00989992002580'), true);
expect(phoneNumberValidator('+989992002580'), true);

expect(phoneNumberValidator('09802002580'), false);
});

Expand All @@ -63,6 +73,8 @@ void main() {
expect(getPhonePrefix('09123200007'), '912');
expect(getPhonePrefix('09300880440'), '930');

expect(getPhonePrefix('09990880440'), '999');

/// Should return the prefix with 98 or +98
expect(getPhonePrefix('+989022002580'), '902');
expect(getPhonePrefix('989122002580'), '912');
Expand Down

0 comments on commit ef5d534

Please sign in to comment.