- Replace dart:js with package:js in health_check_service_web.dart\n- Implement showHealthCheckNotification in web/index.html\n- Pin js dependency to ^0.6.7 for flutter_secure_storage_web compatibility auth: harden AuthInterceptor + tests - Allow overrideAuthRepository injection for testing\n- Normalize imports to package: paths\n- Add unit test covering token attach, 401→refresh→retry, and failure path\n- Add integration test skeleton gated by env vars ui/data: map User.companyName to list column - Add companyName to domain User\n- Map UserDto.company?.name\n- Render companyName in user_list cleanup: remove legacy equipment table + unused code; minor warnings - Remove _buildFlexibleTable and unused helpers\n- Remove unused zipcode details and cache retry constant\n- Fix null-aware and non-null assertions\n- Address child-last warnings in administrator dialog docs: update AGENTS.md session context
42 lines
1.5 KiB
Dart
42 lines
1.5 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:dio/dio.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
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']);
|
|
});
|
|
}
|
|
|