forked from baron/baron-sso
userfront 로그인 후 /dashboard로 이동하게 변경
This commit is contained in:
50
userfront/test/dashboard_screen_smoke_test.dart
Normal file
50
userfront/test/dashboard_screen_smoke_test.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:userfront/core/services/auth_token_store.dart';
|
||||
import 'package:userfront/features/dashboard/presentation/dashboard_screen.dart';
|
||||
|
||||
void main() {
|
||||
setUp(() {
|
||||
AuthTokenStore.clear();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
AuthTokenStore.clear();
|
||||
});
|
||||
|
||||
testWidgets('대시보드는 로그인 토큰이 있으면 크래시 없이 기본 프레임을 렌더링한다', (tester) async {
|
||||
final recordedErrors = <FlutterErrorDetails>[];
|
||||
final previousOnError = FlutterError.onError;
|
||||
FlutterError.onError = (details) {
|
||||
final text = details.exceptionAsString();
|
||||
if (text.contains('A RenderFlex overflowed')) {
|
||||
return;
|
||||
}
|
||||
recordedErrors.add(details);
|
||||
};
|
||||
addTearDown(() {
|
||||
FlutterError.onError = previousOnError;
|
||||
});
|
||||
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
tester.view.physicalSize = const Size(1920, 1080);
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
AuthTokenStore.setToken('smoke-token', provider: 'ory');
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(child: MaterialApp(home: DashboardScreen())),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(Scaffold), findsOneWidget);
|
||||
final hasNullCheckCrash = recordedErrors.any(
|
||||
(error) => error.exceptionAsString().contains(
|
||||
'Null check operator used on a null value',
|
||||
),
|
||||
);
|
||||
expect(hasNullCheckCrash, isFalse);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user