Initial commit: unionflow-mobile-apps

Application Flutter complète (sans build artifacts).

Signed-off-by: lions dev Team
This commit is contained in:
dahoud
2026-03-15 16:30:08 +00:00
commit d094d6db9c
1790 changed files with 507435 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
/// Tests unitaires pour ClearCache use case
library clear_cache_test;
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:unionflow_mobile_apps/features/settings/domain/repositories/system_config_repository.dart';
import 'package:unionflow_mobile_apps/features/settings/domain/usecases/clear_cache.dart';
@GenerateMocks([ISystemConfigRepository])
import 'clear_cache_test.mocks.dart';
void main() {
late ClearCache useCase;
late MockISystemConfigRepository mockRepository;
setUp(() {
mockRepository = MockISystemConfigRepository();
useCase = ClearCache(mockRepository);
});
group('ClearCache Use Case', () {
test('should clear cache successfully', () async {
// Arrange
when(mockRepository.clearCache())
.thenAnswer((_) async => Future.value());
// Act
await useCase();
// Assert
verify(mockRepository.clearCache());
verifyNoMoreInteractions(mockRepository);
});
test('should complete without error when cache is empty', () async {
// Arrange
when(mockRepository.clearCache())
.thenAnswer((_) async => Future.value());
// Act
await useCase();
// Assert
verify(mockRepository.clearCache()).called(1);
});
test('should throw exception when clear operation fails', () async {
// Arrange
when(mockRepository.clearCache())
.thenThrow(Exception('Clear operation failed'));
// Act & Assert
expect(() => useCase(), throwsA(isA<Exception>()));
verify(mockRepository.clearCache());
});
test('should throw exception when permission denied', () async {
// Arrange
when(mockRepository.clearCache())
.thenThrow(Exception('Permission denied'));
// Act & Assert
expect(() => useCase(), throwsException);
});
});
}