1
0
forked from baron/baron-sso
Files
baron-sso/userfront/test/widget_test.dart

41 lines
1.3 KiB
Dart

// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'dart:ui';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:userfront/main.dart' show BaronSSOApp;
class _TestAssetLoader extends AssetLoader {
const _TestAssetLoader();
@override
Future<Map<String, dynamic>> load(String path, Locale locale) async {
return {};
}
}
void main() {
testWidgets('BaronSSOApp builds', (WidgetTester tester) async {
// runApp에서 ProviderScope로 감싸서 쓰고 있으니 테스트도 동일하게 감쌈
await tester.pumpWidget(
EasyLocalization(
supportedLocales: const [Locale('en'), Locale('ko')],
fallbackLocale: const Locale('en'),
startLocale: const Locale('en'),
path: 'assets/translations',
assetLoader: const _TestAssetLoader(),
child: const ProviderScope(child: BaronSSOApp()),
),
);
await tester.pump(); // 한 프레임 더
});
}