-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(BankNameFromCard):add core method test
- Loading branch information
1 parent
60286c3
commit 8839afe
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
lib/src/core/get_bank_name_from_card_number/get_bank_name_from_card_number.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'models.dart'; | ||
|
||
Bank? getBankNameFromCardNumber(String cardNumber) { | ||
return null; | ||
} | ||
|
||
extension BankNameFromCardNumber on String { | ||
Bank? get bankNameFromCard => getBankNameFromCardNumber(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:dart_persian_tools/dart_persian_tools.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('test get_bank_name_from_card_number.dart', () { | ||
test('test getBankNameFromCardNumber method', () { | ||
expect(getBankNameFromCardNumber('6037701689095443')?.name, 'بانک کشاورزی'); | ||
expect(getBankNameFromCardNumber('6219861034529007')?.name, 'بانک سامان'); | ||
expect(getBankNameFromCardNumber('6219861034529007')?.name, 'بانک سامان'); | ||
|
||
expect(getBankNameFromCardNumber('621986103452900'), null); | ||
expect(getBankNameFromCardNumber('9999991034529007'), null); | ||
expect(getBankNameFromCardNumber(''), null); | ||
}); | ||
}); | ||
} |