feat(tests): test coverage is 70.5

This commit is contained in:
misha
2026-01-26 16:38:15 +03:00
parent 92205c09d6
commit 29589ef6fd
49 changed files with 2690 additions and 18 deletions

View File

@@ -80,5 +80,35 @@ void main() {
expect(find.byType(LinearProgressIndicator), findsOneWidget);
});
testWidgets('displays correct progress value for step 0', (tester) async {
final cubit = MockRegistrationCubitV2();
const state = RegistrationStateV2(step: 0);
when(cubit.state).thenReturn(state);
when(cubit.stream).thenAnswer((_) => Stream.value(state));
when(cubit.close()).thenAnswer((_) async => Future<void>.value());
await tester.pumpWidget(wrap(const StepProgress(), cubit));
await tester.pump();
final progressIndicator = tester.widget<LinearProgressIndicator>(find.byType(LinearProgressIndicator));
expect(progressIndicator.value, 0.5);
});
testWidgets('displays correct progress value for step 1', (tester) async {
final cubit = MockRegistrationCubitV2();
const state = RegistrationStateV2(step: 1);
when(cubit.state).thenReturn(state);
when(cubit.stream).thenAnswer((_) => Stream.value(state));
when(cubit.close()).thenAnswer((_) async => Future<void>.value());
await tester.pumpWidget(wrap(const StepProgress(), cubit));
await tester.pump();
final progressIndicator = tester.widget<LinearProgressIndicator>(find.byType(LinearProgressIndicator));
expect(progressIndicator.value, 1.0);
});
});
}

View File

@@ -64,6 +64,32 @@ void main() {
expect(find.byType(StepWidget), findsOneWidget);
});
testWidgets('displays step widget for step 0', (tester) async {
when(mockCubit.state).thenReturn(
const RegistrationStateV2(step: 0),
);
when(mockCubit.stream).thenAnswer((_) => Stream.value(const RegistrationStateV2(step: 0)));
await tester.pumpWidget(createTestWidget());
await tester.pumpAndSettle();
expect(find.byType(StepWidget), findsOneWidget);
expect(find.byType(Text), findsOneWidget);
});
testWidgets('displays step widget for step 1', (tester) async {
when(mockCubit.state).thenReturn(
const RegistrationStateV2(step: 1),
);
when(mockCubit.stream).thenAnswer((_) => Stream.value(const RegistrationStateV2(step: 1)));
await tester.pumpWidget(createTestWidget());
await tester.pumpAndSettle();
expect(find.byType(StepWidget), findsOneWidget);
expect(find.byType(Text), findsOneWidget);
});
});
}