Skip to content

Commit

Permalink
refactor: Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Sep 4, 2024
1 parent 33a3263 commit 76368d9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:altme/app/app.dart';
import 'package:altme/chat_room/chat_room.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/matrix_notification/matrix_notification.dart';
import 'package:altme/onboarding/cubit/onboarding_cubit.dart';
import 'package:altme/onboarding/onboarding.dart';
import 'package:altme/splash/splash.dart';
Expand Down Expand Up @@ -59,6 +60,9 @@ class MockSplashCubit extends MockCubit<SplashState> implements SplashCubit {}
class MockAltmeChatSupportCubit extends MockCubit<ChatRoomState>
implements AltmeChatSupportCubit {}

class MockMatrixNotificationCubit extends MockCubit<ChatRoomState>
implements MatrixNotificationCubit {}

class MockProfileCubit extends MockCubit<ProfileState> implements ProfileCubit {
@override
final state = ProfileState(model: ProfileModel.empty());
Expand All @@ -71,6 +75,7 @@ void main() {
late WalletCubit walletCubit;
late SplashCubit splashCubit;
late AltmeChatSupportCubit altmeChatSupportCubit;
late MatrixNotificationCubit matrixNotificationCubit;
late ProfileCubit profileCubit;
late OnboardingCubit onboardingCubit;

Expand All @@ -82,6 +87,7 @@ void main() {
splashCubit = MockSplashCubit();
walletCubit = MockWalletCubit();
altmeChatSupportCubit = MockAltmeChatSupportCubit();
matrixNotificationCubit = MockMatrixNotificationCubit();
profileCubit = MockProfileCubit();
onboardingCubit = OnboardingCubit();
});
Expand All @@ -99,6 +105,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);
navigator = MockNavigator();
Expand Down
8 changes: 8 additions & 0 deletions test/onboarding/helper_function/helper_function_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:altme/chat_room/chat_room.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/lang/cubit/lang_cubit.dart';
import 'package:altme/lang/cubit/lang_state.dart';
import 'package:altme/matrix_notification/matrix_notification.dart';
import 'package:altme/onboarding/onboarding.dart';
import 'package:altme/splash/splash.dart';
import 'package:altme/wallet/wallet.dart';
Expand Down Expand Up @@ -55,6 +56,9 @@ class MockSplashCubit extends MockCubit<SplashState> implements SplashCubit {}
class MockAltmeChatSupportCubit extends MockCubit<ChatRoomState>
implements AltmeChatSupportCubit {}

class MockMatrixNotificationCubit extends MockCubit<ChatRoomState>
implements MatrixNotificationCubit {}

class MockSecureStorageProvider extends Mock implements SecureStorageProvider {}

class MockLangCubit extends MockCubit<LangState> implements LangCubit {}
Expand All @@ -69,6 +73,7 @@ void main() {
late MockWalletCubit walletCubit;
late MockSplashCubit splashCubit;
late MockAltmeChatSupportCubit altmeChatSupportCubit;
late MatrixNotificationCubit matrixNotificationCubit;
late ProfileCubit profileCubit;
late MockSecureStorageProvider secureStorageProvider;

Expand All @@ -79,6 +84,7 @@ void main() {
walletCubit = MockWalletCubit();
splashCubit = MockSplashCubit();
altmeChatSupportCubit = MockAltmeChatSupportCubit();
matrixNotificationCubit = MockMatrixNotificationCubit();
secureStorageProvider = MockSecureStorageProvider();

when(() => secureStorageProvider.get(any())).thenAnswer((_) async => '');
Expand Down Expand Up @@ -108,6 +114,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -144,6 +151,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down
16 changes: 16 additions & 0 deletions test/onboarding/protect_wallet/view/protect_wallet_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:altme/chat_room/chat_room.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/lang/cubit/lang_state.dart';
import 'package:altme/lang/lang.dart';
import 'package:altme/matrix_notification/matrix_notification.dart';
import 'package:altme/onboarding/cubit/onboarding_cubit.dart';
import 'package:altme/onboarding/onboarding.dart';
import 'package:altme/splash/splash.dart';
Expand Down Expand Up @@ -64,6 +65,9 @@ class MockSplashCubit extends MockCubit<SplashState> implements SplashCubit {}
class MockAltmeChatSupportCubit extends MockCubit<ChatRoomState>
implements AltmeChatSupportCubit {}

class MockMatrixNotificationCubit extends MockCubit<ChatRoomState>
implements MatrixNotificationCubit {}

class MockSecureStorageProvider extends Mock implements SecureStorageProvider {}

class MockLangCubit extends MockCubit<LangState> implements LangCubit {}
Expand All @@ -77,6 +81,7 @@ void main() {
late WalletCubit walletCubit;
late SplashCubit splashCubit;
late AltmeChatSupportCubit altmeChatSupportCubit;
late MatrixNotificationCubit matrixNotificationCubit;
late OnboardingCubit onboardingCubit;
late MockSecureStorageProvider secureStorageProvider;
late MockOIDC4VC oidc4vc;
Expand All @@ -100,6 +105,7 @@ void main() {
splashCubit = MockSplashCubit();
walletCubit = MockWalletCubit();
altmeChatSupportCubit = MockAltmeChatSupportCubit();
matrixNotificationCubit = MockMatrixNotificationCubit();
onboardingCubit = OnboardingCubit();
secureStorageProvider = MockSecureStorageProvider();
oidc4vc = MockOIDC4VC();
Expand Down Expand Up @@ -192,6 +198,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -241,6 +248,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -284,6 +292,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -327,6 +336,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -382,6 +392,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -437,6 +448,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -492,6 +504,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -548,6 +561,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -613,6 +627,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down Expand Up @@ -667,6 +682,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/flavor/flavor.dart';
import 'package:altme/lang/cubit/lang_state.dart';
import 'package:altme/lang/lang.dart';
import 'package:altme/matrix_notification/matrix_notification.dart';
import 'package:altme/onboarding/cubit/onboarding_cubit.dart';
import 'package:altme/onboarding/onboarding.dart';
import 'package:altme/splash/splash.dart';
Expand Down Expand Up @@ -65,6 +66,9 @@ class MockFlavorCubit extends MockCubit<FlavorMode> implements FlavorCubit {}
class MockAltmeChatSupportCubit extends MockCubit<ChatRoomState>
implements AltmeChatSupportCubit {}

class MockMatrixNotificationCubit extends MockCubit<ChatRoomState>
implements MatrixNotificationCubit {}

class MockOnboardingCubit extends MockCubit<OnboardingState>
implements OnboardingCubit {}

Expand All @@ -82,6 +86,7 @@ void main() {
late MockSplashCubit splashCubit;
late MockFlavorCubit flavorCubit;
late AltmeChatSupportCubit altmeChatSupportCubit;
late MatrixNotificationCubit matrixNotificationCubit;
late MockOnboardingCubit onboardingCubit;
late MockNavigator navigator;
late MockSecureStorageProvider secureStorageProvider;
Expand All @@ -99,6 +104,7 @@ void main() {
splashCubit = MockSplashCubit();
flavorCubit = MockFlavorCubit();
altmeChatSupportCubit = MockAltmeChatSupportCubit();
matrixNotificationCubit = MockMatrixNotificationCubit();
onboardingCubit = MockOnboardingCubit();
navigator = MockNavigator();
secureStorageProvider = MockSecureStorageProvider();
Expand Down Expand Up @@ -168,6 +174,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -214,6 +221,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -260,6 +268,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -338,6 +347,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -410,6 +420,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down Expand Up @@ -463,6 +474,7 @@ void main() {
walletCubit: walletCubit,
splashCubit: splashCubit,
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: ProfileCubit(
didKitProvider: didKitProvider,
jwtDecode: JWTDecode(),
Expand Down
11 changes: 11 additions & 0 deletions test/splash/cubit/splash_cubit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:altme/app/app.dart';
import 'package:altme/chat_room/chat_room.dart';
import 'package:altme/credentials/credentials.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/matrix_notification/cubit/matrix_notification_cubit.dart';
import 'package:altme/splash/cubit/splash_cubit.dart';
import 'package:altme/wallet/wallet.dart';
import 'package:bloc_test/bloc_test.dart';
Expand All @@ -23,6 +24,9 @@ class MockHomeCubit extends MockCubit<HomeState> implements HomeCubit {
class MockAltmeChatSupportCubit extends MockCubit<ChatRoomState>
implements AltmeChatSupportCubit {}

class MockMatrixNotificationCubit extends MockCubit<ChatRoomState>
implements MatrixNotificationCubit {}

class MockCredentialsCubit extends MockCubit<CredentialsState>
implements CredentialsCubit {
@override
Expand Down Expand Up @@ -72,6 +76,7 @@ void main() {
late CredentialsCubit credentialsCubit;
late WalletCubit walletCubit;
late AltmeChatSupportCubit altmeChatSupportCubit;
late MatrixNotificationCubit matrixNotificationCubit;
late ProfileCubit profileCubit;

final packageInfo = PackageInfo(
Expand All @@ -88,6 +93,7 @@ void main() {
credentialsCubit = MockCredentialsCubit();
walletCubit = MockWalletCubit();
altmeChatSupportCubit = MockAltmeChatSupportCubit();
matrixNotificationCubit = MockMatrixNotificationCubit();
profileCubit = MockProfileCubit();

when(() => mockSecureStorage.get(SecureStorageKeys.version))
Expand All @@ -114,6 +120,7 @@ void main() {
dio: Dio(),
),
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
packageInfo: packageInfo,
).state,
Expand All @@ -140,6 +147,7 @@ void main() {
dio: Dio(),
),
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
packageInfo: packageInfo,
);
Expand Down Expand Up @@ -187,6 +195,7 @@ void main() {
dio: Dio(),
),
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
packageInfo: packageInfo,
);
Expand Down Expand Up @@ -216,6 +225,7 @@ void main() {
dio: Dio(),
),
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
packageInfo: packageInfo,
);
Expand Down Expand Up @@ -245,6 +255,7 @@ void main() {
dio: Dio(),
),
altmeChatSupportCubit: altmeChatSupportCubit,
matrixNotificationCubit: matrixNotificationCubit,
profileCubit: profileCubit,
packageInfo: packageInfo,
);
Expand Down

0 comments on commit 76368d9

Please sign in to comment.