import 'package:flutter_test/flutter_test.dart';
import 'package:provider/provider.dart';

import 'package:pweb/app/app.dart';
import 'package:pweb/providers/account.dart';
import 'package:pweb/providers/locale.dart';
import 'package:pshared/provider/account.dart';
import 'package:pshared/provider/locale.dart';

void main() {
  testWidgets('PayApp builds with required providers', (
    WidgetTester tester,
  ) async {
    await tester.pumpWidget(
      MultiProvider(
        providers: [
          ChangeNotifierProvider<LocaleProvider>(
            create: (_) => PwebLocaleProvider(null),
          ),
          ChangeNotifierProxyProvider<LocaleProvider, AccountProvider>(
            create: (_) => PwebAccountProvider(),
            update: (context, localeProvider, provider) =>
                provider!..updateProvider(localeProvider),
          ),
        ],
        child: const PayApp(),
      ),
    );

    await tester.pumpAndSettle();
    expect(find.byType(PayApp), findsOneWidget);
  });
}
