사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -3,11 +3,11 @@ import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/injection_container.dart' as di;
|
||||
import 'package:superport/services/warehouse_service.dart';
|
||||
import 'package:superport/services/company_service.dart';
|
||||
import 'package:superport/services/license_service.dart';
|
||||
// import 'package:superport/services/license_service.dart'; // License 시스템 제거
|
||||
import 'package:superport/services/equipment_service.dart';
|
||||
import 'package:superport/models/warehouse_location_model.dart';
|
||||
import 'package:superport/models/company_model.dart';
|
||||
import 'package:superport/models/license_model.dart';
|
||||
// import 'package:superport/models/license_model.dart'; // License 시스템 제거
|
||||
import 'package:superport/models/address_model.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/utils/phone_utils.dart';
|
||||
@@ -16,7 +16,7 @@ void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
late WarehouseService warehouseService;
|
||||
late CompanyService companyService;
|
||||
late LicenseService licenseService;
|
||||
// late LicenseService licenseService; // License 시스템 제거
|
||||
late EquipmentService equipmentService;
|
||||
|
||||
setUpAll(() async {
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
|
||||
warehouseService = GetIt.instance<WarehouseService>();
|
||||
companyService = GetIt.instance<CompanyService>();
|
||||
licenseService = GetIt.instance<LicenseService>();
|
||||
// licenseService = GetIt.instance<LicenseService>(); // License 시스템 제거
|
||||
equipmentService = GetIt.instance<EquipmentService>();
|
||||
});
|
||||
|
||||
@@ -191,105 +191,17 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('유지보수 라이선스 CRUD 테스트', () {
|
||||
int? createdLicenseId;
|
||||
int? testCompanyId;
|
||||
|
||||
setUpAll(() async {
|
||||
// 테스트용 회사 생성
|
||||
final company = Company(
|
||||
name: 'License Test Company ${DateTime.now().millisecondsSinceEpoch}',
|
||||
address: const Address(region: '서울'),
|
||||
companyTypes: [CompanyType.customer],
|
||||
);
|
||||
final created = await companyService.createCompany(company);
|
||||
testCompanyId = created.id;
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
// 테스트용 회사 삭제
|
||||
if (testCompanyId != null) {
|
||||
await companyService.deleteCompany(testCompanyId!);
|
||||
}
|
||||
});
|
||||
|
||||
test('라이선스 생성', () async {
|
||||
final license = License(
|
||||
licenseKey: 'TEST-KEY-${DateTime.now().millisecondsSinceEpoch}',
|
||||
productName: 'Test Product',
|
||||
vendor: 'Test Vendor',
|
||||
companyId: testCompanyId,
|
||||
purchaseDate: DateTime.now().subtract(const Duration(days: 30)),
|
||||
expiryDate: DateTime.now().add(const Duration(days: 335)),
|
||||
isActive: true,
|
||||
);
|
||||
|
||||
final created = await licenseService.createLicense(license);
|
||||
createdLicenseId = created.id;
|
||||
|
||||
expect(created.id, isNotNull);
|
||||
expect(created.licenseKey, equals(license.licenseKey));
|
||||
expect(created.productName, equals(license.productName));
|
||||
});
|
||||
|
||||
test('라이선스 수정 - 제한된 필드만 수정 가능', () async {
|
||||
if (createdLicenseId == null) {
|
||||
return; // skip 대신 return 사용
|
||||
}
|
||||
|
||||
// UpdateLicenseRequest DTO에 포함된 필드만 수정 가능
|
||||
final license = License(
|
||||
id: createdLicenseId,
|
||||
licenseKey: 'SHOULD-NOT-CHANGE', // 수정 불가
|
||||
productName: 'Updated Product', // 수정 가능
|
||||
vendor: 'Updated Vendor', // 수정 가능
|
||||
expiryDate: DateTime.now().add(const Duration(days: 365)), // 수정 가능
|
||||
isActive: false, // 수정 가능
|
||||
);
|
||||
|
||||
final updated = await licenseService.updateLicense(license);
|
||||
|
||||
expect(updated.productName, equals('Updated Product'));
|
||||
expect(updated.vendor, equals('Updated Vendor'));
|
||||
expect(updated.isActive, equals(false));
|
||||
// license_key는 수정되지 않아야 함
|
||||
expect(updated.licenseKey, isNot(equals('SHOULD-NOT-CHANGE')));
|
||||
});
|
||||
|
||||
test('라이선스 조회', () async {
|
||||
if (createdLicenseId == null) {
|
||||
return; // skip 대신 return 사용
|
||||
}
|
||||
|
||||
final license = await licenseService.getLicenseById(createdLicenseId!);
|
||||
|
||||
expect(license.id, equals(createdLicenseId));
|
||||
expect(license.licenseKey, isNotEmpty);
|
||||
});
|
||||
|
||||
test('라이선스 삭제', () async {
|
||||
if (createdLicenseId == null) {
|
||||
return; // skip 대신 return 사용
|
||||
}
|
||||
|
||||
await expectLater(
|
||||
licenseService.deleteLicense(createdLicenseId!),
|
||||
completes,
|
||||
);
|
||||
});
|
||||
});
|
||||
// License 시스템이 Maintenance 시스템으로 대체되었습니다.
|
||||
// 이전 License 관련 테스트는 제거되었습니다.
|
||||
// Maintenance 테스트는 별도 파일에서 관리합니다.
|
||||
|
||||
group('장비 관리 CRUD 테스트', () {
|
||||
int? createdEquipmentId;
|
||||
|
||||
test('장비 생성', () async {
|
||||
final equipment = Equipment(
|
||||
manufacturer: 'Test Manufacturer',
|
||||
equipmentNumber: 'Test Equipment ${DateTime.now().millisecondsSinceEpoch}', // name → equipmentNumber
|
||||
modelName: 'Test Model ${DateTime.now().millisecondsSinceEpoch}', // 새로운 필수 필드
|
||||
category1: 'Test Category', // category → category1
|
||||
category2: 'Test SubCategory', // subCategory → category2
|
||||
category3: 'Test SubSubCategory', // subSubCategory → category3
|
||||
equipmentNumber: 'Test Equipment ${DateTime.now().millisecondsSinceEpoch}',
|
||||
modelsId: 1, // Vendor→Model 관계로 변경됨
|
||||
quantity: 5,
|
||||
serialNumber: 'SN-${DateTime.now().millisecondsSinceEpoch}',
|
||||
);
|
||||
@@ -298,7 +210,7 @@ void main() {
|
||||
createdEquipmentId = created.id;
|
||||
|
||||
expect(created.id, isNotNull);
|
||||
expect(created.manufacturer, equals(equipment.manufacturer));
|
||||
// expect(created.manufacturer, equals(equipment.manufacturer)); // manufacturer 필드 제거됨
|
||||
expect(created.equipmentNumber, equals(equipment.equipmentNumber)); // name → equipmentNumber
|
||||
});
|
||||
|
||||
@@ -311,24 +223,20 @@ void main() {
|
||||
final loaded = await equipmentService.getEquipmentDetail(createdEquipmentId!);
|
||||
|
||||
expect(loaded.id, equals(createdEquipmentId));
|
||||
expect(loaded.manufacturer, isNotEmpty);
|
||||
// expect(loaded.manufacturer, isNotEmpty); // manufacturer 필드 제거됨
|
||||
expect(loaded.equipmentNumber, isNotEmpty); // name → equipmentNumber
|
||||
|
||||
// 수정
|
||||
final equipment = Equipment(
|
||||
id: createdEquipmentId,
|
||||
manufacturer: 'Updated Manufacturer',
|
||||
equipmentNumber: 'Updated Equipment', // name → equipmentNumber
|
||||
modelName: 'Updated Model', // 새로운 필수 필드
|
||||
category1: loaded.category1, // category → category1
|
||||
category2: loaded.category2, // subCategory → category2
|
||||
category3: loaded.category3, // subSubCategory → category3
|
||||
equipmentNumber: 'Updated Equipment',
|
||||
modelsId: loaded.modelsId, // Vendor→Model 관계 유지
|
||||
quantity: 10,
|
||||
);
|
||||
|
||||
final updated = await equipmentService.updateEquipment(createdEquipmentId!, equipment);
|
||||
|
||||
expect(updated.manufacturer, equals('Updated Manufacturer'));
|
||||
// expect(updated.manufacturer, equals('Updated Manufacturer')); // manufacturer 필드 제거됨
|
||||
expect(updated.name, equals('Updated Equipment'));
|
||||
expect(updated.quantity, equals(10));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user