Skip to content

Commit

Permalink
refactor: fixed broke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wilburx9 committed Mar 14, 2021
1 parent 4fe13dd commit 08c8459
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/src/api/service/contracts/banks_service_contract.dart
Expand Up @@ -10,5 +10,5 @@ abstract class BankServiceContract {
Future<TransactionApiResponse> validateToken(
BankChargeRequestBody? requestBody, Map<String, String?> fields);

Future<List<Bank>?> fetchSupportedBanks();
Future<List<Bank>?>? fetchSupportedBanks();
}
2 changes: 1 addition & 1 deletion lib/src/widgets/checkout/bank_checkout.dart
Expand Up @@ -38,7 +38,7 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
late AnimationController _controller;
late Animation<double> _animation;
var _autoValidate = AutovalidateMode.disabled;
Future<List<Bank>?>? _futureBanks;
late Future<List<Bank>?>? _futureBanks;
Bank? _currentBank;
BankAccount? _account;
var _loading = false;
Expand Down
4 changes: 2 additions & 2 deletions test/src/common/card_utils_test.dart
Expand Up @@ -58,10 +58,10 @@ void main() {
Case(inp: 10, out: true),
Case(inp: 100, out: true),
Case(inp: 1000, out: true),
Case(inp: 20, out: false),
Case(inp: 23, out: false),
Case(inp: 2000, out: true),
Case(inp: 94, out: false),
Case(inp: 2020, out: false),
Case(inp: 2024, out: false),
Case(inp: 87656776, out: false),
Case(inp: 8, out: true),
Case(inp: 0, out: true),
Expand Down
6 changes: 4 additions & 2 deletions test/src/common/paystack_test.dart
Expand Up @@ -5,7 +5,8 @@ import 'package:flutter_paystack/src/common/paystack.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
const MethodChannel channel = MethodChannel('plugins.wilburt/flutter_paystack');
const MethodChannel channel = MethodChannel(
'plugins.wilburt/flutter_paystack');

TestWidgetsFlutterBinding.ensureInitialized();

Expand All @@ -22,7 +23,8 @@ void main() {
group("$PaystackPlugin", () {
test('is properly initialized with passed key', () async {
var publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";
final plugin = await PaystackPlugin().initialize(publicKey: publicKey);
final plugin = PaystackPlugin();
await plugin.initialize(publicKey: publicKey);
expect(publicKey, plugin.publicKey);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/src/models/card_test.dart
Expand Up @@ -205,7 +205,7 @@ void main() {
number: "6011000000000004",
cvc: "123",
expiryMonth: 09,
expiryYear: 20),
expiryYear: 23),
out: true),
];

Expand Down
8 changes: 2 additions & 6 deletions test/src/widgets/checkout/card_checkout_test.dart
Expand Up @@ -14,13 +14,9 @@ import '../../common/widget_builder.dart';
class MockedCardService extends Mock implements CardServiceContract {}

void main() {
late String publicKey;

setUp(() {
publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";
});

group("$CardCheckout", () {
String publicKey = Platform.environment["PAYSTACK_TEST_PUBLIC_KEY"] ?? "";

final charge = Charge()
..amount = 20000
..currency = "USD"
Expand Down

0 comments on commit 08c8459

Please sign in to comment.