TDD 작성

This commit is contained in:
2025-08-12 03:28:08 +09:00
parent 6033d59590
commit 107abc963f
156 changed files with 70906 additions and 642 deletions
+12 -2
View File
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
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;
@@ -8,14 +9,23 @@ import '../models/event_model.dart';
class NotificationService {
static NotificationService _instance = NotificationService._internal();
factory NotificationService() => _instance;
NotificationService._internal();
// 생성자에서 플러그인을 주입받을 수 있도록 변경
NotificationService._internal([FlutterLocalNotificationsPlugin? plugin])
: _notificationsPlugin = plugin ?? FlutterLocalNotificationsPlugin();
// 테스트용 인스턴스 설정 메서드
static void setTestInstance(NotificationService instance) {
_instance = instance;
}
// 테스트용 인스턴스 생성 포함한 새 메서드
@visibleForTesting
static NotificationService createTestInstance(FlutterLocalNotificationsPlugin mockPlugin) {
return NotificationService._internal(mockPlugin);
}
final FlutterLocalNotificationsPlugin _notificationsPlugin = FlutterLocalNotificationsPlugin();
final FlutterLocalNotificationsPlugin _notificationsPlugin;
bool _isInitialized = false;
// 알림 서비스 초기화