test: 통합 테스트 오류 및 경고 수정
- 모든 서비스 메서드 시그니처를 실제 구현에 맞게 수정 - TestDataGenerator 제거하고 직접 객체 생성으로 변경 - 모델 필드명 및 타입 불일치 수정 - 불필요한 Either 패턴 사용 제거 - null safety 관련 이슈 해결 수정된 파일: - test/integration/screens/company_integration_test.dart - test/integration/screens/equipment_integration_test.dart - test/integration/screens/user_integration_test.dart - test/integration/screens/login_integration_test.dart
This commit is contained in:
@@ -19,20 +19,28 @@ class ApiClient {
|
||||
|
||||
ApiClient._internal() {
|
||||
try {
|
||||
print('[ApiClient] 초기화 시작');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] 초기화 시작');
|
||||
}
|
||||
_dio = Dio(_baseOptions);
|
||||
print('[ApiClient] Dio 인스턴스 생성 완료');
|
||||
print('[ApiClient] Base URL: ${_dio.options.baseUrl}');
|
||||
print('[ApiClient] Connect Timeout: ${_dio.options.connectTimeout}');
|
||||
print('[ApiClient] Receive Timeout: ${_dio.options.receiveTimeout}');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] Dio 인스턴스 생성 완료');
|
||||
debugPrint('[ApiClient] Base URL: ${_dio.options.baseUrl}');
|
||||
debugPrint('[ApiClient] Connect Timeout: ${_dio.options.connectTimeout}');
|
||||
debugPrint('[ApiClient] Receive Timeout: ${_dio.options.receiveTimeout}');
|
||||
}
|
||||
_setupInterceptors();
|
||||
print('[ApiClient] 인터셉터 설정 완료');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] 인터셉터 설정 완료');
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
print('[ApiClient] ⚠️ 에러 발생: $e');
|
||||
print('[ApiClient] Stack trace: $stackTrace');
|
||||
if (kDebugMode) {
|
||||
debugPrint('[ApiClient] ⚠️ 에러 발생: $e');
|
||||
debugPrint('[ApiClient] Stack trace: $stackTrace');
|
||||
}
|
||||
// 기본값으로 초기화
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://superport.naturebridgeai.com/api/v1',
|
||||
baseUrl: 'http://43.201.34.104:8080/api/v1',
|
||||
connectTimeout: const Duration(seconds: 30),
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
headers: {
|
||||
@@ -41,7 +49,9 @@ class ApiClient {
|
||||
},
|
||||
));
|
||||
_setupInterceptors();
|
||||
print('[ApiClient] 기본값으로 초기화 완료');
|
||||
if (kDebugMode) {
|
||||
debugPrint('[ApiClient] 기본값으로 초기화 완료');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +76,7 @@ class ApiClient {
|
||||
} catch (e) {
|
||||
// Environment가 초기화되지 않은 경우 기본값 사용
|
||||
return BaseOptions(
|
||||
baseUrl: 'https://superport.naturebridgeai.com/api/v1',
|
||||
baseUrl: 'http://43.201.34.104:8080/api/v1',
|
||||
connectTimeout: const Duration(seconds: 30),
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
headers: {
|
||||
@@ -143,8 +153,10 @@ class ApiClient {
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) {
|
||||
print('[ApiClient] POST 요청 시작: $path');
|
||||
print('[ApiClient] 요청 데이터: $data');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] POST 요청 시작: $path');
|
||||
debugPrint('[ApiClient] 요청 데이터: $data');
|
||||
}
|
||||
|
||||
return _dio.post<T>(
|
||||
path,
|
||||
@@ -155,14 +167,18 @@ class ApiClient {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
print('[ApiClient] POST 응답 수신: ${response.statusCode}');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] POST 응답 수신: ${response.statusCode}');
|
||||
}
|
||||
return response;
|
||||
}).catchError((error) {
|
||||
print('[ApiClient] POST 에러 발생: $error');
|
||||
if (error is DioException) {
|
||||
print('[ApiClient] DioException 타입: ${error.type}');
|
||||
print('[ApiClient] DioException 메시지: ${error.message}');
|
||||
print('[ApiClient] DioException 에러: ${error.error}');
|
||||
if (Environment.enableLogging && kDebugMode) {
|
||||
debugPrint('[ApiClient] POST 에러 발생: $error');
|
||||
if (error is DioException) {
|
||||
debugPrint('[ApiClient] DioException 타입: ${error.type}');
|
||||
debugPrint('[ApiClient] DioException 메시지: ${error.message}');
|
||||
debugPrint('[ApiClient] DioException 에러: ${error.error}');
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user