diff --git a/pubspec.yaml b/pubspec.yaml index ba245593f..1a30f23be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: altme description: AltMe Flutter App version: 2.5.9+459 -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: sdk: ">=3.1.0 <4.0.0" diff --git a/test/pin_code/view/pin_code_page_test.dart b/test/pin_code/view/pin_code_page_test.dart new file mode 100644 index 000000000..92192333d --- /dev/null +++ b/test/pin_code/view/pin_code_page_test.dart @@ -0,0 +1,126 @@ +// import 'package:altme/app/app.dart'; +// import 'package:altme/dashboard/dashboard.dart'; +// import 'package:altme/flavor/flavor.dart'; +// import 'package:altme/pin_code/pin_code.dart'; +// import 'package:bloc_test/bloc_test.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_bloc/flutter_bloc.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockingjay/mockingjay.dart'; +// import 'package:secure_storage/secure_storage.dart'; + +// import '../../helpers/helpers.dart'; + +// class MockProfleCubit extends MockCubit implements ProfileCubit { +// @override +// final state = ProfileState(model: ProfileModel.empty()); +// } + +// class MockSecureStorageProvider extends Mock implements SecureStorageProvider {} + +// class MockLocalAuthApi extends Mock implements LocalAuthApi {} + +// class MockFlavorCubit extends MockCubit implements FlavorCubit { +// @override +// final state = FlavorMode.development; +// } + +// void main() { +// group('Pincode Page', () { +// final PinCodeViewCubit pinCodeViewCubit = PinCodeViewCubit(); +// final MockNavigator navigator = MockNavigator(); +// final MockSecureStorageProvider secureStorageProvider = +// MockSecureStorageProvider(); +// final MockProfleCubit profleCubit = MockProfleCubit(); +// final MockLocalAuthApi localAuthApi = MockLocalAuthApi(); +// final MockFlavorCubit flavorCubit = MockFlavorCubit(); + +// setUpAll(() { +// when(() => secureStorageProvider.get(any())).thenAnswer((_) async => ''); + +// when(() => secureStorageProvider.set(any(), any())) +// .thenAnswer((_) async => Future.value()); + +// when(navigator.canPop).thenReturn(true); +// when(() => navigator.push(any())).thenAnswer((_) async {}); +// when(() => navigator.pushAndRemoveUntil(any(), any())) +// .thenAnswer((_) async {}); +// when(() => navigator.pushReplacement(any())) +// .thenAnswer((_) async {}); +// }); + +// testWidgets('is routable', (tester) async { +// await tester.pumpApp( +// MockNavigatorProvider( +// navigator: navigator, +// child: Builder( +// builder: (context) => Scaffold( +// floatingActionButton: FloatingActionButton( +// onPressed: () { +// Navigator.of(context).push( +// PinCodePage.route( +// isValidCallback: () {}, +// walletProtectionType: WalletProtectionType.FA2, +// ), +// ); +// }, +// ), +// ), +// ), +// ), +// ); +// await tester.tap(find.byType(FloatingActionButton)); +// await tester.pumpAndSettle(); + +// verify( +// () => navigator.push( +// any( +// that: isRoute( +// whereName: equals('/pinCodePage'), +// ), +// ), +// ), +// ).called(1); +// }); + +// testWidgets('renders PinCodePage', (tester) async { +// await tester.pumpApp( +// MultiBlocProvider( +// providers: [ +// BlocProvider.value(value: profleCubit), +// BlocProvider.value(value: pinCodeViewCubit), +// BlocProvider.value(value: flavorCubit), +// ], +// child: PinCodePage( +// isValidCallback: () {}, +// walletProtectionType: WalletProtectionType.FA2, +// secureStorageProvider: secureStorageProvider, +// localAuthApi: localAuthApi, +// ), +// ), +// ); +// expect(find.byType(PinCodeView), findsOneWidget); +// }); + +// testWidgets('renders UI correctly', (tester) async { +// await tester.pumpApp( +// MultiBlocProvider( +// providers: [ +// BlocProvider.value(value: profleCubit), +// BlocProvider.value(value: pinCodeViewCubit), +// BlocProvider.value(value: flavorCubit), +// ], +// child: PinCodeView( +// isValidCallback: () {}, +// walletProtectionType: WalletProtectionType.FA2, +// secureStorageProvider: secureStorageProvider, +// localAuthApi: localAuthApi, +// profileCubit: profleCubit, +// ), +// ), +// ); +// expect(find.byType(BasePage), findsOneWidget); +// expect(find.byType(PinCodeWidget), findsOneWidget); +// }); +// }); +// }