Skip to content

Commit 08c8459

Browse files
committed
refactor: fixed broke tests
1 parent 4fe13dd commit 08c8459

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

lib/src/api/service/contracts/banks_service_contract.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ abstract class BankServiceContract {
1010
Future<TransactionApiResponse> validateToken(
1111
BankChargeRequestBody? requestBody, Map<String, String?> fields);
1212

13-
Future<List<Bank>?> fetchSupportedBanks();
13+
Future<List<Bank>?>? fetchSupportedBanks();
1414
}

lib/src/widgets/checkout/bank_checkout.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
3838
late AnimationController _controller;
3939
late Animation<double> _animation;
4040
var _autoValidate = AutovalidateMode.disabled;
41-
Future<List<Bank>?>? _futureBanks;
41+
late Future<List<Bank>?>? _futureBanks;
4242
Bank? _currentBank;
4343
BankAccount? _account;
4444
var _loading = false;

test/src/common/card_utils_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ void main() {
5858
Case(inp: 10, out: true),
5959
Case(inp: 100, out: true),
6060
Case(inp: 1000, out: true),
61-
Case(inp: 20, out: false),
61+
Case(inp: 23, out: false),
6262
Case(inp: 2000, out: true),
6363
Case(inp: 94, out: false),
64-
Case(inp: 2020, out: false),
64+
Case(inp: 2024, out: false),
6565
Case(inp: 87656776, out: false),
6666
Case(inp: 8, out: true),
6767
Case(inp: 0, out: true),

test/src/common/paystack_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import 'package:flutter_paystack/src/common/paystack.dart';
55
import 'package:flutter_test/flutter_test.dart';
66

77
void main() {
8-
const MethodChannel channel = MethodChannel('plugins.wilburt/flutter_paystack');
8+
const MethodChannel channel = MethodChannel(
9+
'plugins.wilburt/flutter_paystack');
910

1011
TestWidgetsFlutterBinding.ensureInitialized();
1112

@@ -22,7 +23,8 @@ void main() {
2223
group("$PaystackPlugin", () {
2324
test('is properly initialized with passed key', () async {
2425
var publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";
25-
final plugin = await PaystackPlugin().initialize(publicKey: publicKey);
26+
final plugin = PaystackPlugin();
27+
await plugin.initialize(publicKey: publicKey);
2628
expect(publicKey, plugin.publicKey);
2729
});
2830
});

test/src/models/card_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void main() {
205205
number: "6011000000000004",
206206
cvc: "123",
207207
expiryMonth: 09,
208-
expiryYear: 20),
208+
expiryYear: 23),
209209
out: true),
210210
];
211211

test/src/widgets/checkout/card_checkout_test.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ import '../../common/widget_builder.dart';
1414
class MockedCardService extends Mock implements CardServiceContract {}
1515

1616
void main() {
17-
late String publicKey;
18-
19-
setUp(() {
20-
publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";
21-
});
22-
2317
group("$CardCheckout", () {
18+
String publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";
19+
2420
final charge = Charge()
2521
..amount = 20000
2622
..currency = "USD"

0 commit comments

Comments
 (0)