Skip to content

Commit

Permalink
test(BankNameFromCard):add core method test
Browse files Browse the repository at this point in the history
  • Loading branch information
payam-zahedi committed Apr 19, 2021
1 parent 60286c3 commit 8839afe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/dart_persian_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ export 'src/core/phone_number/phone_number.dart';

// exports [getPlaceByNationalId] method and extension
export 'src/core/get_place_by_national_id/get_place_by_national_id.dart';

// exports [getBankNameFromCardNumber] method and extension
export 'src/core/get_bank_name_from_card_number/get_bank_name_from_card_number.dart';
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);
}
16 changes: 16 additions & 0 deletions test/test_get_bank_name_from_card_number.dart
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);
});
});
}

0 comments on commit 8839afe

Please sign in to comment.