이벤트 가져오기 위젯 테스트 추가 및 테스트 훅 도입
This commit is contained in:
@@ -5,7 +5,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:timezone/data/latest.dart' as tz_data;
|
||||
import 'package:lanebow/models/event_model.dart';
|
||||
import 'package:lanebow/services/event_bus.dart';
|
||||
import '../utils/event_bus_test_utils.dart';
|
||||
import 'package:lanebow/utils/test_utils.dart';
|
||||
|
||||
// 모킹 클래스 생성
|
||||
@@ -17,16 +17,13 @@ void main() {
|
||||
late MockFlutterLocalNotificationsPlugin mockNotificationsPlugin;
|
||||
|
||||
// 테스트 전 설정
|
||||
setUp(() {
|
||||
setUp(() async {
|
||||
// 테스트 모드 강제 설정
|
||||
TestUtils.setTestMode(true);
|
||||
|
||||
// 테스트별 고유 ID 생성 및 설정
|
||||
final testId = 'notification_service_test_${DateTime.now().millisecondsSinceEpoch}';
|
||||
EventBus.setCurrentTestId(testId);
|
||||
|
||||
// EventBus 완전 초기화
|
||||
EventBus().reset();
|
||||
await EventBusTestUtils.setUp(testId);
|
||||
|
||||
// 모킹된 알림 플러그인 생성
|
||||
mockNotificationsPlugin = MockFlutterLocalNotificationsPlugin();
|
||||
@@ -59,12 +56,9 @@ void main() {
|
||||
tz_data.initializeTimeZones();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
// 테스트 종료 후 EventBus 초기화
|
||||
EventBus().reset();
|
||||
|
||||
// 테스트 ID 초기화
|
||||
EventBus.clearCurrentTestId();
|
||||
tearDown(() async {
|
||||
// EventBus 표준 정리
|
||||
await EventBusTestUtils.tearDown();
|
||||
|
||||
// 테스트 모드 해제
|
||||
TestUtils.setTestMode(false);
|
||||
|
||||
Reference in New Issue
Block a user