- 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).
46 lines
1.7 KiB
Dart
46 lines
1.7 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:dio/dio.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
const bool RUN_EXTERNAL_TESTS = bool.fromEnvironment('RUN_EXTERNAL_TESTS');
|
|
void main() {
|
|
if (!RUN_EXTERNAL_TESTS) {
|
|
test('External tests disabled', () {}, skip: 'Enable with --dart-define=RUN_EXTERNAL_TESTS=true');
|
|
return;
|
|
}
|
|
final baseUrl = Platform.environment['INTEGRATION_API_BASE_URL'];
|
|
final username = Platform.environment['INTEGRATION_LOGIN_USERNAME'];
|
|
final password = Platform.environment['INTEGRATION_LOGIN_PASSWORD'];
|
|
|
|
group('Auth Integration (real API)', () {
|
|
test('health endpoint responds', () async {
|
|
if (baseUrl == null || baseUrl.isEmpty) {
|
|
return; // silently succeed when not configured
|
|
}
|
|
final dio = Dio(BaseOptions(baseUrl: baseUrl));
|
|
final res = await dio.get('/health');
|
|
expect(res.statusCode, inInclusiveRange(200, 204));
|
|
}, tags: ['integration']);
|
|
|
|
test('login and get users (requires credentials)', () async {
|
|
if (baseUrl == null || username == null || password == null) {
|
|
return; // silently succeed when not configured
|
|
}
|
|
final dio = Dio(BaseOptions(baseUrl: baseUrl));
|
|
final loginRes = await dio.post('/auth/login', data: {
|
|
'username': username,
|
|
'password': password,
|
|
});
|
|
expect(loginRes.statusCode, inInclusiveRange(200, 204));
|
|
|
|
final accessToken = loginRes.data['access_token'] as String?;
|
|
expect(accessToken, isNotNull);
|
|
|
|
dio.options.headers['Authorization'] = 'Bearer $accessToken';
|
|
final usersRes = await dio.get('/users');
|
|
expect(usersRes.statusCode, inInclusiveRange(200, 204));
|
|
}, tags: ['integration']);
|
|
});
|
|
}
|