이벤트 가져오기 위젯 테스트 추가 및 테스트 훅 도입

This commit is contained in:
2025-09-12 06:33:44 +09:00
parent 107abc963f
commit a5f2544d11
121 changed files with 39277 additions and 3911 deletions
@@ -4,11 +4,9 @@ import 'package:mockito/mockito.dart';
import 'package:mockito/annotations.dart';
import 'package:http/http.dart' as http;
import 'package:lanebow/services/subscription_service.dart';
import 'package:lanebow/services/event_bus.dart';
import 'package:lanebow/models/subscription_model.dart';
import 'package:lanebow/config/api_config.dart';
import 'package:lanebow/services/in_app_purchase_service.dart';
import 'package:lanebow/utils/test_utils.dart';
import '../utils/event_bus_test_utils.dart';
// 모킹 클래스 생성
@GenerateMocks([http.Client, InAppPurchaseService])
@@ -87,16 +85,13 @@ void main() {
}
];
setUp(() {
setUp(() async {
// 테스트 모드 강제 설정
TestUtils.setTestMode(true);
// 테스트별 고유 ID 생성 및 설정
final testId = 'subscription_service_test_${DateTime.now().millisecondsSinceEpoch}';
EventBus.setCurrentTestId(testId);
// EventBus 완전 초기화
EventBus().reset();
await EventBusTestUtils.setUp(testId);
// HTTP 클라이언트 모킹
mockClient = MockClient();
@@ -132,15 +127,12 @@ void main() {
);
});
tearDown(() {
// 테스트 종료 후 EventBus 초기화
EventBus().reset();
tearDown(() async {
// 테스트에서 생성된 SubscriptionService 정리
subscriptionService.dispose();
try { subscriptionService.dispose(); } catch (_) {}
// 테스트 ID 초기화
EventBus.clearCurrentTestId();
// EventBus 표준 정리
await EventBusTestUtils.tearDown();
// 테스트 모드 해제
TestUtils.setTestMode(false);