Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.3 kB
2
Indexable
Never
// ignore_for_file: prefer_const_constructors

import 'package:ad1sales/provider/providers.dart';
import 'package:ad1sales/ui/screens/screens.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:provider/provider.dart';

import 'test_helper/test_helper.mocks.dart';

void main() {
  late LoginChangeNotifier loginChangeNotifier;

  setUp(() {
    loginChangeNotifier = LoginChangeNotifier(
      usersRepository: MockUsersRepository(),
      secureStorage: MockFlutterSecureStorage(),
      mobileGatewayRepository: MockMobileGatewayRepositoriesV2(),
      pushNotificationService: MockPushNotificationService(),
      firebaseMessaging: MockFirebaseMessaging(),
      globalFunction: MockGlobalFunctionV2(),
      permissionProvider: MockPermissionChangeNotifer(),
    );
  });

  group('Login', () {
    testWidgets('Login Page', (tester) async {
      // when(() => loginChangeNotifier.state).thenReturn(42);
      await tester.pumpWidget(
        MaterialApp(
          home: ChangeNotifierProvider(
            create: (BuildContext context) => loginChangeNotifier,
            child: Login(),
          ),
        ),
      );
      expect(find.byType(HeaderLogin), findsOneWidget);
      expect(find.byType(WelcomingLogin), findsOneWidget);
    });
  });
}
Leave a Comment