refactor: UI 화면 통합 및 불필요한 파일 정리
- 모든 *_redesign.dart 파일을 기본 화면 파일로 통합 - 백업용 컨트롤러 파일들 제거 (*_controller.backup.dart) - 사용하지 않는 예제 및 테스트 파일 제거 - Clean Architecture 적용 후 남은 정리 작업 완료 - 테스트 코드 정리 및 구조 개선 준비 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -128,7 +128,7 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
|
||||
// 기능 감지
|
||||
final features = await detectFeatures(metadata);
|
||||
_log('감지된 기능: ${features.map((f) => f.featureName).join(', ')}');
|
||||
_log('감지된 기능: ${features.items.map((f) => f.featureName).join(', ')}');
|
||||
|
||||
// 테스트 실행
|
||||
final result = await executeTests(features);
|
||||
@@ -266,7 +266,7 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
// createdIds를 resourceType별로 분류
|
||||
for (final id in createdIds) {
|
||||
final parts = id.split(':');
|
||||
if (parts.length == 2) {
|
||||
if (parts.items.length == 2) {
|
||||
final resourceType = parts[0];
|
||||
final resourceId = parts[1];
|
||||
resourcesByType.putIfAbsent(resourceType, () => []).add(resourceId);
|
||||
@@ -375,9 +375,9 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
);
|
||||
|
||||
testContext.setData('readResults', results);
|
||||
testContext.setData('readCount', results is List ? results.length : 1);
|
||||
testContext.setData('readCount', results is List ? results.items.length : 1);
|
||||
|
||||
_log('[READ] 성공: ${results is List ? results.length : 1}개 항목');
|
||||
_log('[READ] 성공: ${results is List ? results.items.length : 1}개 항목');
|
||||
} catch (e) {
|
||||
_log('[READ] 실패: $e');
|
||||
|
||||
@@ -496,7 +496,7 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
await performCreate(data);
|
||||
|
||||
final service = getService();
|
||||
final searchKeyword = data.data['name']?.toString().split(' ').first ?? 'test';
|
||||
final searchKeyword = data.data['name']?.toString().split(' ').items.first ?? 'test';
|
||||
|
||||
final results = await service.search(searchKeyword);
|
||||
testContext.setData('searchResults', results);
|
||||
@@ -511,9 +511,9 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
expect(searchResults, isNotNull, reason: '검색 결과가 없음');
|
||||
expect(searchResults, isA<List>(), reason: '올바른 검색 결과 형식이 아님');
|
||||
|
||||
if (searchResults.isNotEmpty) {
|
||||
if (searchResults.items.isNotEmpty) {
|
||||
// 검색 결과가 키워드를 포함하는지 확인
|
||||
final firstResult = searchResults.first;
|
||||
final firstResult = searchResults.items.first;
|
||||
expect(
|
||||
firstResult.toString().toLowerCase(),
|
||||
contains(searchKeyword.toLowerCase()),
|
||||
@@ -564,9 +564,9 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
expect(page2Results, isNotNull, reason: '두 번째 페이지 결과가 없음');
|
||||
|
||||
// 페이지별 결과가 다른지 확인 (데이터가 충분한 경우)
|
||||
if (page1Results.isNotEmpty && page2Results.isNotEmpty) {
|
||||
if (page1Results.items.isNotEmpty && page2Results.items.isNotEmpty) {
|
||||
expect(
|
||||
page1Results.first.id != page2Results.first.id,
|
||||
page1Results.items.first.id != page2Results.items.first.id,
|
||||
isTrue,
|
||||
reason: '페이지네이션이 올바르게 작동하지 않음',
|
||||
);
|
||||
@@ -658,7 +658,7 @@ abstract class BaseScreenTest extends ScreenTestFramework {
|
||||
final fixResult = await autoFixer.attemptAutoFix(diagnosis);
|
||||
|
||||
if (fixResult.success) {
|
||||
_log('자동 수정 성공: ${fixResult.executedActions.length}개 액션 적용');
|
||||
_log('자동 수정 성공: ${fixResult.executedActions.items.length}개 액션 적용');
|
||||
|
||||
// 수정 액션 적용 (AutoFixResult는 String 액션을 반환)
|
||||
// TODO: String 액션을 FixAction으로 변환하거나 별도 처리 필요
|
||||
|
||||
@@ -169,11 +169,11 @@ class ExampleEquipmentScreenTest extends BaseScreenTest {
|
||||
final equipmentData = data.data;
|
||||
|
||||
// 필수 필드 검증
|
||||
if (equipmentData['manufacturer'] == null || equipmentData['manufacturer'].isEmpty) {
|
||||
if (equipmentData['manufacturer'] == null || equipmentData['manufacturer'].items.isEmpty) {
|
||||
throw ValidationError('제조사는 필수 입력 항목입니다');
|
||||
}
|
||||
|
||||
if (equipmentData['name'] == null || equipmentData['name'].isEmpty) {
|
||||
if (equipmentData['name'] == null || equipmentData['name'].items.isEmpty) {
|
||||
throw ValidationError('장비명은 필수 입력 항목입니다');
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ class EquipmentInAutomatedTest extends BaseScreenTest {
|
||||
);
|
||||
|
||||
expect(diagnosis.errorType, equals(ErrorType.missingRequiredField));
|
||||
_log('진단 결과: ${diagnosis.missingFields?.length ?? 0}개 필드 누락');
|
||||
_log('진단 결과: ${diagnosis.missingFields?.items.length ?? 0}개 필드 누락');
|
||||
|
||||
// 자동 수정
|
||||
final fixResult = await autoFixer.attemptAutoFix(diagnosis);
|
||||
|
||||
@@ -34,8 +34,8 @@ void assertTrue(bool condition, {String? message}) {
|
||||
}
|
||||
|
||||
void assertIsNotEmpty(dynamic collection, {String? message}) {
|
||||
if (collection == null || (collection is Iterable && collection.isEmpty) ||
|
||||
(collection is Map && collection.isEmpty)) {
|
||||
if (collection == null || (collection is Iterable && collection.items.isEmpty) ||
|
||||
(collection is Map && collection.items.isEmpty)) {
|
||||
throw AssertionError(message ?? 'Expected non-empty collection');
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class EquipmentInFullTest {
|
||||
_test10CompleteIncoming,
|
||||
];
|
||||
|
||||
results['totalTests'] = tests.length;
|
||||
results['totalTests'] = tests.items.length;
|
||||
|
||||
// 각 테스트 실행
|
||||
for (final test in tests) {
|
||||
@@ -234,7 +234,7 @@ class EquipmentInFullTest {
|
||||
|
||||
assertEqual(statusFilter.statusCode, 200, message: '상태 필터링 응답이 200이어야 합니다');
|
||||
final availableEquipment = statusFilter.data['data'] as List;
|
||||
debugPrint('[TEST 2] 사용 가능한 장비 수: ${availableEquipment.length}');
|
||||
debugPrint('[TEST 2] 사용 가능한 장비 수: ${availableEquipment.items.length}');
|
||||
|
||||
// 모든 조회된 장비가 'available' 상태인지 확인
|
||||
for (final equipment in availableEquipment) {
|
||||
@@ -243,8 +243,8 @@ class EquipmentInFullTest {
|
||||
}
|
||||
|
||||
// 회사별 필터링 (예시)
|
||||
if (availableEquipment.isNotEmpty) {
|
||||
final companyId = availableEquipment.first['company_id'];
|
||||
if (availableEquipment.items.isNotEmpty) {
|
||||
final companyId = availableEquipment.items.first['company_id'];
|
||||
final companyFilter = await apiClient.dio.get(
|
||||
'/equipment',
|
||||
queryParameters: {
|
||||
@@ -256,7 +256,7 @@ class EquipmentInFullTest {
|
||||
|
||||
assertEqual(companyFilter.statusCode, 200,
|
||||
message: '회사별 필터링 응답이 200이어야 합니다');
|
||||
debugPrint('[TEST 2] 회사 ID $companyId의 장비 수: ${companyFilter.data['data'].length}');
|
||||
debugPrint('[TEST 2] 회사 ID $companyId의 장비 수: ${companyFilter.data['data'].items.length}');
|
||||
}
|
||||
|
||||
debugPrint('[TEST 2] ✅ 장비 검색 및 필터링 성공');
|
||||
@@ -312,7 +312,7 @@ class EquipmentInFullTest {
|
||||
debugPrint('[TEST 4] 장비 정보 수정 시작...');
|
||||
|
||||
// 수정할 장비가 없으면 먼저 생성
|
||||
if (createdEquipmentIds.isEmpty) {
|
||||
if (createdEquipmentIds.items.isEmpty) {
|
||||
await _createTestEquipment();
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ class EquipmentInFullTest {
|
||||
debugPrint('[TEST 6] 장비 상태 변경 시작...');
|
||||
|
||||
// 상태 변경할 장비가 없으면 생성
|
||||
if (createdEquipmentIds.isEmpty) {
|
||||
if (createdEquipmentIds.items.isEmpty) {
|
||||
await _createTestEquipment();
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ class EquipmentInFullTest {
|
||||
debugPrint('[TEST 7] 장비 이력 추가 시작...');
|
||||
|
||||
// 이력 추가할 장비가 없으면 생성
|
||||
if (createdEquipmentIds.isEmpty) {
|
||||
if (createdEquipmentIds.items.isEmpty) {
|
||||
await _createTestEquipment();
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ class EquipmentInFullTest {
|
||||
// 실제 이미지 업로드는 파일 시스템 접근이 필요하므로
|
||||
// 여기서는 메타데이터만 테스트
|
||||
|
||||
if (createdEquipmentIds.isEmpty) {
|
||||
if (createdEquipmentIds.items.isEmpty) {
|
||||
await _createTestEquipment();
|
||||
}
|
||||
|
||||
@@ -524,10 +524,10 @@ class EquipmentInFullTest {
|
||||
);
|
||||
|
||||
final results = response.data['data'] as List;
|
||||
if (results.isEmpty) {
|
||||
if (results.items.isEmpty) {
|
||||
debugPrint('[TEST 9] 바코드에 해당하는 장비 없음 - 새 장비 등록 필요');
|
||||
} else {
|
||||
debugPrint('[TEST 9] 바코드에 해당하는 장비 찾음: ${results.first['name']}');
|
||||
debugPrint('[TEST 9] 바코드에 해당하는 장비 찾음: ${results.items.first['name']}');
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('[TEST 9] 바코드 검색 중 에러 (예상됨): $e');
|
||||
@@ -547,7 +547,7 @@ class EquipmentInFullTest {
|
||||
debugPrint('[TEST 10] 입고 완료 처리 시작...');
|
||||
|
||||
// 입고 처리할 장비가 없으면 생성
|
||||
if (createdEquipmentIds.isEmpty) {
|
||||
if (createdEquipmentIds.items.isEmpty) {
|
||||
await _createTestEquipment();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class EquipmentOutScreenTest extends BaseScreenTest {
|
||||
perPage: 10,
|
||||
);
|
||||
|
||||
if (equipments.isEmpty) {
|
||||
if (equipments.items.isEmpty) {
|
||||
_log('출고 가능한 장비가 없음, 새 장비 생성 필요');
|
||||
// 테스트를 위해 장비를 먼저 입고시킴
|
||||
await _createAndStockEquipment();
|
||||
@@ -170,7 +170,7 @@ class EquipmentOutScreenTest extends BaseScreenTest {
|
||||
|
||||
expect(availableEquipments, isNotEmpty, reason: '출고 가능한 장비가 없습니다');
|
||||
|
||||
final targetEquipment = availableEquipments.first;
|
||||
final targetEquipment = availableEquipments.items.first;
|
||||
_log('출고 대상 장비: ${targetEquipment.name} (ID: ${targetEquipment.id})');
|
||||
|
||||
// 2. 출고 요청 데이터 생성
|
||||
@@ -266,13 +266,13 @@ class EquipmentOutScreenTest extends BaseScreenTest {
|
||||
perPage: 10,
|
||||
);
|
||||
|
||||
if (equipments.isEmpty) {
|
||||
if (equipments.items.isEmpty) {
|
||||
_log('테스트할 장비가 없음');
|
||||
testContext.setData('insufficientInventoryTested', false);
|
||||
return;
|
||||
}
|
||||
|
||||
final targetEquipment = equipments.first;
|
||||
final targetEquipment = equipments.items.first;
|
||||
final availableQuantity = targetEquipment.quantity;
|
||||
|
||||
// 재고보다 많은 수량으로 출고 시도
|
||||
|
||||
@@ -427,10 +427,10 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
_log('만료 예정 라이선스 조회 중...');
|
||||
final expiringLicenses = await licenseService.getExpiringLicenses(days: 30);
|
||||
|
||||
_log('30일 이내 만료 예정 라이선스: ${expiringLicenses.length}개');
|
||||
_log('30일 이내 만료 예정 라이선스: ${expiringLicenses.items.length}개');
|
||||
|
||||
// 3. 방금 생성한 라이선스가 포함되어 있는지 확인
|
||||
final hasOurLicense = expiringLicenses.any((l) => l.id == created.id);
|
||||
final hasOurLicense = expiringLicenses.items.any((l) => l.id == created.id);
|
||||
|
||||
testContext.setData('expiringLicenseCreated', created);
|
||||
testContext.setData('expiringLicensesList', expiringLicenses);
|
||||
@@ -494,10 +494,10 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
isActive: false,
|
||||
);
|
||||
|
||||
_log('비활성 라이선스: ${inactiveLicenses.length}개');
|
||||
_log('비활성 라이선스: ${inactiveLicenses.items.length}개');
|
||||
|
||||
// 3. 만료된 라이선스가 비활성 목록에 있는지 확인
|
||||
final hasExpiredLicense = inactiveLicenses.any((l) => l.id == created.id);
|
||||
final hasExpiredLicense = inactiveLicenses.items.any((l) => l.id == created.id);
|
||||
|
||||
testContext.setData('expiredLicenseCreated', created);
|
||||
testContext.setData('inactiveLicensesList', inactiveLicenses);
|
||||
@@ -551,7 +551,7 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
await licenseService.createLicense(invalidLicense);
|
||||
_log('⚠️ 잘못된 키가 허용됨: "$invalidKey"');
|
||||
} catch (e) {
|
||||
_log('✓ 예상된 검증 에러 발생: "$invalidKey" - ${e.toString().split('\n').first}');
|
||||
_log('✓ 예상된 검증 에러 발생: "$invalidKey" - ${e.toString().split('\n').items.first}');
|
||||
validationErrors++;
|
||||
}
|
||||
}
|
||||
@@ -645,7 +645,7 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
await licenseService.createLicense(duplicateLicense);
|
||||
_log('⚠️ 중복 라이선스 키가 허용되었습니다');
|
||||
} catch (e) {
|
||||
_log('✓ 예상된 중복 에러 발생: ${e.toString().split('\n').first}');
|
||||
_log('✓ 예상된 중복 에러 발생: ${e.toString().split('\n').items.first}');
|
||||
duplicateRejected = true;
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
);
|
||||
|
||||
expect(diagnosis.errorType, equals(ErrorType.missingRequiredField));
|
||||
_log('진단 결과: ${diagnosis.missingFields?.length ?? 0}개 필드 누락');
|
||||
_log('진단 결과: ${diagnosis.missingFields?.items.length ?? 0}개 필드 누락');
|
||||
|
||||
// 자동 수정
|
||||
final fixResult = await autoFixer.attemptAutoFix(diagnosis);
|
||||
@@ -892,8 +892,8 @@ class LicenseScreenTest extends BaseScreenTest {
|
||||
// 2. 사용자 목록 조회 (할당할 사용자 찾기)
|
||||
final users = await userService.getUsers(page: 1, perPage: 10);
|
||||
|
||||
if (users.isNotEmpty) {
|
||||
final targetUser = users.first;
|
||||
if (users.items.isNotEmpty) {
|
||||
final targetUser = users.items.first;
|
||||
_log('할당 대상 사용자: ${targetUser.name} (ID: ${targetUser.id})');
|
||||
|
||||
// 3. 라이선스 할당
|
||||
@@ -1034,7 +1034,7 @@ class LicenseTestData {
|
||||
// 라이선스 키 생성기
|
||||
static String generateLicenseKey() {
|
||||
final prefixes = ['PRO', 'ENT', 'STD', 'TRIAL', 'DEV', 'PROD'];
|
||||
final prefix = prefixes[random.nextInt(prefixes.length)];
|
||||
final prefix = prefixes[random.nextInt(prefixes.items.length)];
|
||||
final timestamp = DateTime.now().millisecondsSinceEpoch.toString().substring(6);
|
||||
final randomPart = random.nextInt(9999).toString().padLeft(4, '0');
|
||||
|
||||
@@ -1061,7 +1061,7 @@ class LicenseTestData {
|
||||
'MongoDB Enterprise',
|
||||
];
|
||||
|
||||
return products[random.nextInt(products.length)];
|
||||
return products[random.nextInt(products.items.length)];
|
||||
}
|
||||
|
||||
// 벤더명 생성기
|
||||
@@ -1084,13 +1084,13 @@ class LicenseTestData {
|
||||
'Elastic',
|
||||
];
|
||||
|
||||
return vendors[random.nextInt(vendors.length)];
|
||||
return vendors[random.nextInt(vendors.items.length)];
|
||||
}
|
||||
|
||||
// 라이선스 타입 생성기
|
||||
static String generateLicenseType() {
|
||||
final types = ['perpetual', 'subscription', 'trial', 'oem', 'academic', 'nfr'];
|
||||
return types[random.nextInt(types.length)];
|
||||
return types[random.nextInt(types.items.length)];
|
||||
}
|
||||
|
||||
// 구매일 생성기 (과거 2년 이내)
|
||||
|
||||
@@ -178,7 +178,7 @@ class OverviewScreenTest extends BaseScreenTest {
|
||||
'totalEquipment': overviewController.overviewStats?.totalEquipment ?? 0,
|
||||
'activeEquipment': overviewController.overviewStats?.availableEquipment ?? 0,
|
||||
'totalLicenses': overviewController.overviewStats?.totalLicenses ?? 0,
|
||||
'expiringLicenses': overviewController.expiringLicenses.length,
|
||||
'expiringLicenses': overviewController.expiringLicenses.items.length,
|
||||
'totalCompanies': overviewController.totalCompanies,
|
||||
'totalUsers': overviewController.totalUsers,
|
||||
'totalWarehouses': overviewController.overviewStats?.totalWarehouseLocations ?? 0,
|
||||
@@ -361,7 +361,7 @@ class OverviewScreenTest extends BaseScreenTest {
|
||||
'totalEquipment': overviewController.overviewStats?.totalEquipment ?? 0,
|
||||
'activeEquipment': overviewController.overviewStats?.availableEquipment ?? 0,
|
||||
'totalLicenses': overviewController.overviewStats?.totalLicenses ?? 0,
|
||||
'expiringLicenses': overviewController.expiringLicenses.length,
|
||||
'expiringLicenses': overviewController.expiringLicenses.items.length,
|
||||
'totalCompanies': overviewController.totalCompanies,
|
||||
'totalUsers': overviewController.totalUsers,
|
||||
'totalWarehouses': overviewController.overviewStats?.totalWarehouseLocations ?? 0,
|
||||
|
||||
Reference in New Issue
Block a user