forked from eatvio/eatvio_app
feat(tests): test coverage is 70.5
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user