TDD 작성
This commit is contained in:
@@ -5,6 +5,8 @@ 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 'package:lanebow/utils/test_utils.dart';
|
||||
|
||||
// 모킹 클래스 생성
|
||||
@GenerateMocks([FlutterLocalNotificationsPlugin])
|
||||
@@ -16,6 +18,16 @@ void main() {
|
||||
|
||||
// 테스트 전 설정
|
||||
setUp(() {
|
||||
// 테스트 모드 강제 설정
|
||||
TestUtils.setTestMode(true);
|
||||
|
||||
// 테스트별 고유 ID 생성 및 설정
|
||||
final testId = 'notification_service_test_${DateTime.now().millisecondsSinceEpoch}';
|
||||
EventBus.setCurrentTestId(testId);
|
||||
|
||||
// EventBus 완전 초기화
|
||||
EventBus().reset();
|
||||
|
||||
// 모킹된 알림 플러그인 생성
|
||||
mockNotificationsPlugin = MockFlutterLocalNotificationsPlugin();
|
||||
|
||||
@@ -48,7 +60,14 @@ void main() {
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
// 필요한 정리 작업
|
||||
// 테스트 종료 후 EventBus 초기화
|
||||
EventBus().reset();
|
||||
|
||||
// 테스트 ID 초기화
|
||||
EventBus.clearCurrentTestId();
|
||||
|
||||
// 테스트 모드 해제
|
||||
TestUtils.setTestMode(false);
|
||||
});
|
||||
|
||||
group('NotificationService 테스트', () {
|
||||
|
||||
Reference in New Issue
Block a user