Files
superport/test/api_integration_test.dart
JiWoong Sul 49b203d366
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled
feat(ui): full‑width ShadTable across app; fix rent dialog width; correct equipment pagination
- ShadTable: ensure full-width via LayoutBuilder+ConstrainedBox minWidth
- BaseListScreen: default data area padding = 0 for table edge-to-edge
- Vendor/Model/User/Company/Inventory/Zipcode: set columnSpanExtent per column
  and add final filler column to absorb remaining width; pin date/status/actions
  widths; ensure date text is single-line
- Equipment: unify card/border style; define fixed column widths + filler;
  increase checkbox column to 56px to avoid overflow
- Rent list: migrate to ShadTable.list with fixed widths + filler column
- Rent form dialog: prevent infinite width by bounding ShadProgress with
  SizedBox and remove Expanded from option rows; add safe selectedOptionBuilder
- Admin list: fix const with non-const argument in table column extents
- Services/Controller: remove hardcoded perPage=10; use BaseListController
  perPage; trust server meta (total/totalPages) in equipment pagination
- widgets/shad_table: ConstrainedBox(minWidth=viewport) so table stretches

Run: flutter analyze → 0 errors (warnings remain).
2025-09-09 22:38:08 +09:00

69 lines
2.4 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
import 'package:get_it/get_it.dart';
import 'package:superport/injection_container.dart' as di;
import 'package:superport/data/datasources/remote/dashboard_remote_datasource.dart';
import 'package:superport/data/datasources/remote/lookup_remote_datasource.dart';
import 'package:superport/core/services/lookups_service.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
setUpAll(() async {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});
await di.init();
});
tearDownAll(() {
GetIt.instance.reset();
});
group('New API Integration Tests', () {
test('DashboardRemoteDataSource should have getLicenseExpirySummary method', () {
final dataSource = GetIt.instance<DashboardRemoteDataSource>();
expect(dataSource, isNotNull);
// 메서드가 존재하는지 확인
expect(dataSource.getLicenseExpirySummary, isA<Function>());
});
test('LookupRemoteDataSource should be registered', () {
final dataSource = GetIt.instance<LookupRemoteDataSource>();
expect(dataSource, isNotNull);
// 메서드들이 존재하는지 확인
expect(dataSource.getAllLookups, isA<Function>());
expect(dataSource.getLookupsByType, isA<Function>());
});
test('LookupsService should be registered', () {
final service = GetIt.instance<LookupsService>();
expect(service, isNotNull);
// 프로퍼티와 메서드 확인
expect(service.isInitialized, isFalse); // 초기 상태
expect(service.initialize, isA<Function>());
});
test('License expiry summary API endpoint should be callable', () async {
final dataSource = GetIt.instance<DashboardRemoteDataSource>();
// API 호출 (실제 네트워크 호출이므로 실패할 수 있음)
final result = await dataSource.getLicenseExpirySummary();
// Either 타입 확인
expect(result.isLeft() || result.isRight(), isTrue);
});
test('Lookups API endpoint should be callable', () async {
final dataSource = GetIt.instance<LookupRemoteDataSource>();
// API 호출 (실제 네트워크 호출이므로 실패할 수 있음)
final result = await dataSource.getAllLookups();
// Either 타입 확인
expect(result.isLeft() || result.isRight(), isTrue);
});
});
}