|
|
|
|
@ -2,16 +2,14 @@
|
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
import 'package:compass_app/data/repositories/auth/auth_repository.dart';
|
|
|
|
|
import 'package:compass_app/data/repositories/itinerary_config/itinerary_config_repository.dart';
|
|
|
|
|
import 'package:compass_app/routing/routes.dart';
|
|
|
|
|
import 'package:compass_app/ui/auth/logout/view_models/logout_viewmodel.dart';
|
|
|
|
|
import 'package:compass_app/ui/home/view_models/home_viewmodel.dart';
|
|
|
|
|
import 'package:compass_app/ui/home/widgets/home_screen.dart';
|
|
|
|
|
import 'package:compass_app/utils/result.dart';
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:mocktail/mocktail.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../testing/app.dart';
|
|
|
|
|
import '../../../../testing/fakes/repositories/fake_auth_repository.dart';
|
|
|
|
|
@ -24,6 +22,7 @@ import '../../../../testing/models/booking.dart';
|
|
|
|
|
void main() {
|
|
|
|
|
group('HomeScreen tests', () {
|
|
|
|
|
late HomeViewModel viewModel;
|
|
|
|
|
late LogoutViewModel logoutViewModel;
|
|
|
|
|
late MockGoRouter goRouter;
|
|
|
|
|
late FakeBookingRepository bookingRepository;
|
|
|
|
|
|
|
|
|
|
@ -33,6 +32,10 @@ void main() {
|
|
|
|
|
bookingRepository: bookingRepository,
|
|
|
|
|
userRepository: FakeUserRepository(),
|
|
|
|
|
);
|
|
|
|
|
logoutViewModel = LogoutViewModel(
|
|
|
|
|
authRepository: FakeAuthRepository(),
|
|
|
|
|
itineraryConfigRepository: FakeItineraryConfigRepository(),
|
|
|
|
|
);
|
|
|
|
|
goRouter = MockGoRouter();
|
|
|
|
|
when(() => goRouter.push(any())).thenAnswer((_) => Future.value(null));
|
|
|
|
|
});
|
|
|
|
|
@ -40,12 +43,9 @@ void main() {
|
|
|
|
|
Future<void> loadWidget(WidgetTester tester) async {
|
|
|
|
|
await testApp(
|
|
|
|
|
tester,
|
|
|
|
|
ChangeNotifierProvider.value(
|
|
|
|
|
value: FakeAuthRepository() as AuthRepository,
|
|
|
|
|
child: Provider.value(
|
|
|
|
|
value: FakeItineraryConfigRepository() as ItineraryConfigRepository,
|
|
|
|
|
child: HomeScreen(viewModel: viewModel),
|
|
|
|
|
),
|
|
|
|
|
HomeScreen(
|
|
|
|
|
viewModel: viewModel,
|
|
|
|
|
logoutViewModel: logoutViewModel,
|
|
|
|
|
),
|
|
|
|
|
goRouter: goRouter,
|
|
|
|
|
);
|
|
|
|
|
|