Skip to content

Commit

Permalink
package update and add some test for pincode but commented for now
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed May 31, 2024
1 parent a89d278 commit de0cd26
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
126 changes: 126 additions & 0 deletions test/pin_code/view/pin_code_page_test.dart
Original file line number Diff line number Diff line change
@@ -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<ProfileState> 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<FlavorMode> 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<void>.value());

// when(navigator.canPop).thenReturn(true);
// when(() => navigator.push<void>(any())).thenAnswer((_) async {});
// when(() => navigator.pushAndRemoveUntil<void>(any(), any()))
// .thenAnswer((_) async {});
// when(() => navigator.pushReplacement<void, void>(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<void>(
// PinCodePage.route(
// isValidCallback: () {},
// walletProtectionType: WalletProtectionType.FA2,
// ),
// );
// },
// ),
// ),
// ),
// ),
// );
// await tester.tap(find.byType(FloatingActionButton));
// await tester.pumpAndSettle();

// verify(
// () => navigator.push<void>(
// any(
// that: isRoute<void>(
// whereName: equals('/pinCodePage'),
// ),
// ),
// ),
// ).called(1);
// });

// testWidgets('renders PinCodePage', (tester) async {
// await tester.pumpApp(
// MultiBlocProvider(
// providers: [
// BlocProvider<ProfileCubit>.value(value: profleCubit),
// BlocProvider<PinCodeViewCubit>.value(value: pinCodeViewCubit),
// BlocProvider<FlavorCubit>.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<ProfileCubit>.value(value: profleCubit),
// BlocProvider<PinCodeViewCubit>.value(value: pinCodeViewCubit),
// BlocProvider<FlavorCubit>.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);
// });
// });
// }

0 comments on commit de0cd26

Please sign in to comment.