refactor: centralize data connect error handling and resolve build issues across applications
This commit addresses several critical issues across the mobile monorepo:
1. Centralized Error Handling: Integrated DataErrorHandler mixin into all repository implementations, ensuring consistent mapping of Data Connect exceptions to domain AppExceptions.
2. Build Stabilization: Fixed numerous type mismatches, parameter signature errors in widgets (e.g., google_places_flutter itemBuilder), and naming conflicts (StaffSession, FirebaseAuth).
3. Code Quality: Applied 'dart fix' across all modified packages and manually cleared debug print statements and UI clutter.
4. Mono-repo alignment: Standardized Data Connect usage and aliasing ('dc.') for better maintainability.
Signed-off-by: Suriya <suriya@tenext.in>
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
import 'package:client_main/src/presentation/blocs/client_main_cubit.dart';
|
||||
import 'package:client_main/src/presentation/blocs/client_main_state.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
|
||||
class MockIModularNavigator extends Mock implements IModularNavigator {}
|
||||
|
||||
void main() {
|
||||
group('ClientMainCubit', () {
|
||||
late MockIModularNavigator navigator;
|
||||
|
||||
setUp(() {
|
||||
navigator = MockIModularNavigator();
|
||||
when(() => navigator.path).thenReturn('/home');
|
||||
when(() => navigator.addListener(any())).thenReturn(null);
|
||||
// Stub addListener to avoid errors when Cubit adds listener
|
||||
// Note: addListener might be on Modular directly or via some other mechanic,
|
||||
// but for this unit test we just want to suppress errors if possible or let the Cubit work.
|
||||
// Actually Modular.to.addListener calls Modular.navigatorDelegate.addListener if it exists?
|
||||
// Modular.to.addListener uses the internal RouterDelegate.
|
||||
// Mocking Modular internals is hard.
|
||||
|
||||
// Let's rely on the fact that we mocked navigatorDelegate.
|
||||
Modular.navigatorDelegate = navigator;
|
||||
});
|
||||
|
||||
test('initial state is correct', () {
|
||||
final ClientMainCubit cubit = ClientMainCubit();
|
||||
expect(cubit.state, const ClientMainState(currentIndex: 2));
|
||||
cubit.close();
|
||||
});
|
||||
|
||||
// Note: Testing actual route changes requires more complex Modular mocking
|
||||
// or integration tests, but the structure allows it.
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user