feat: BLoC tests complets + sécurité production + freerasp 7.5.1 migration
## Tests BLoC (Task P2.4 Mobile) - 25 nouveaux fichiers *_bloc_test.dart + mocks générés (build_runner) - Features couvertes : authentication, admin_users, adhesions, backup, communication/messaging, contributions, dashboard, finance (approval/budget), events, explore/network, feed, logs_monitoring, notifications, onboarding, organizations (switcher/types/CRUD), profile, reports, settings, solidarity - ~380 tests, > 80% coverage BLoCs ## Sécurité Production (Task P2.2) - lib/core/security/app_integrity_service.dart (freerasp 7.5.1) - Migration API breaking changes freerasp 7.5.1 : - onRootDetected → onPrivilegedAccess - onDebuggerDetected → onDebug - onSignatureDetected → onAppIntegrity - onHookDetected → onHooks - onEmulatorDetected → onSimulator - onUntrustedInstallationSourceDetected → onUnofficialStore - onDeviceBindingDetected → onDeviceBinding - onObfuscationIssuesDetected → onObfuscationIssues - Talsec.start() split → start() + attachListener() - const AndroidConfig/IOSConfig → final (constructors call ConfigVerifier) - supportedAlternativeStores → supportedStores ## Pubspec - bloc_test: ^9.1.7 → ^10.0.0 (compat flutter_bloc ^9.0.0) - freerasp 7.5.1 ## Config - android/app/build.gradle : ajustements release - lib/core/config/environment.dart : URLs API actualisées - lib/main.dart + app_router : intégrations sécurité/BLoC ## Cleanup - Suppression docs intermédiaires (TACHES_*.md, TASK_*_COMPLETION_REPORT.md, TESTS_UNITAIRES_PROGRESS.md) - .g.dart régénérés (json_serializable) - .mocks.dart régénérés (mockito) ## Résultat - 142 fichiers, +27 596 insertions - Toutes les tâches P2 mobile complétées Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
605
test/features/dashboard/bloc/dashboard_bloc_test.dart
Normal file
605
test/features/dashboard/bloc/dashboard_bloc_test.dart
Normal file
@@ -0,0 +1,605 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'package:unionflow_mobile_apps/core/config/environment.dart';
|
||||
import 'package:unionflow_mobile_apps/core/error/failures.dart';
|
||||
import 'package:unionflow_mobile_apps/core/websocket/websocket_service.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/domain/entities/dashboard_entity.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/domain/usecases/get_dashboard_data.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/presentation/bloc/dashboard_bloc.dart';
|
||||
|
||||
@GenerateMocks([
|
||||
GetDashboardData,
|
||||
GetDashboardStats,
|
||||
GetRecentActivities,
|
||||
GetUpcomingEvents,
|
||||
WebSocketService,
|
||||
])
|
||||
import 'dashboard_bloc_test.mocks.dart';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Test fixtures
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
DashboardStatsEntity _buildStats() => DashboardStatsEntity(
|
||||
totalMembers: 100,
|
||||
activeMembers: 80,
|
||||
totalEvents: 10,
|
||||
upcomingEvents: 3,
|
||||
totalContributions: 50,
|
||||
totalContributionAmount: 500000,
|
||||
pendingRequests: 5,
|
||||
completedProjects: 2,
|
||||
monthlyGrowth: 0.05,
|
||||
engagementRate: 0.8,
|
||||
lastUpdated: DateTime(2026, 4, 20),
|
||||
);
|
||||
|
||||
DashboardEntity _buildDashboardEntity({
|
||||
String orgId = 'org-1',
|
||||
String userId = 'user-1',
|
||||
}) =>
|
||||
DashboardEntity(
|
||||
stats: _buildStats(),
|
||||
recentActivities: const [],
|
||||
upcomingEvents: const [],
|
||||
userPreferences: const {},
|
||||
organizationId: orgId,
|
||||
userId: userId,
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers to keep WebSocketService mock compiling without excessive stub noise
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void _stubWebSocket(MockWebSocketService ws) {
|
||||
// Provide broadcast streams so the bloc can subscribe without NPE
|
||||
final eventController = StreamController<WebSocketEvent>.broadcast();
|
||||
final statusController = StreamController<bool>.broadcast();
|
||||
|
||||
when(ws.eventStream).thenAnswer((_) => eventController.stream);
|
||||
when(ws.connectionStatusStream).thenAnswer((_) => statusController.stream);
|
||||
when(ws.connect()).thenReturn(null);
|
||||
when(ws.disconnect()).thenReturn(null);
|
||||
when(ws.isConnected).thenReturn(false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void main() {
|
||||
// AppConfig uses late final statics — initialize once before any tests run
|
||||
setUpAll(() {
|
||||
try {
|
||||
AppConfig.initialize();
|
||||
} catch (_) {
|
||||
// Already initialized by a previous test suite in the same process
|
||||
}
|
||||
});
|
||||
|
||||
late MockGetDashboardData mockGetDashboardData;
|
||||
late MockGetDashboardStats mockGetDashboardStats;
|
||||
late MockGetRecentActivities mockGetRecentActivities;
|
||||
late MockGetUpcomingEvents mockGetUpcomingEvents;
|
||||
late MockWebSocketService mockWebSocketService;
|
||||
|
||||
setUp(() {
|
||||
mockGetDashboardData = MockGetDashboardData();
|
||||
mockGetDashboardStats = MockGetDashboardStats();
|
||||
mockGetRecentActivities = MockGetRecentActivities();
|
||||
mockGetUpcomingEvents = MockGetUpcomingEvents();
|
||||
mockWebSocketService = MockWebSocketService();
|
||||
_stubWebSocket(mockWebSocketService);
|
||||
});
|
||||
|
||||
DashboardBloc buildBloc() => DashboardBloc(
|
||||
getDashboardData: mockGetDashboardData,
|
||||
getDashboardStats: mockGetDashboardStats,
|
||||
getRecentActivities: mockGetRecentActivities,
|
||||
getUpcomingEvents: mockGetUpcomingEvents,
|
||||
webSocketService: mockWebSocketService,
|
||||
);
|
||||
|
||||
// blocs are closed inside blocTest automatically — no explicit tearDown needed
|
||||
|
||||
// ─── initial state ───────────────────────────────────────────────────────
|
||||
|
||||
test('initial state is DashboardInitial', () {
|
||||
final bloc = buildBloc();
|
||||
expect(bloc.state, isA<DashboardInitial>());
|
||||
bloc.close();
|
||||
});
|
||||
|
||||
// ─── LoadDashboardData ───────────────────────────────────────────────────
|
||||
|
||||
group('LoadDashboardData', () {
|
||||
final entity = _buildDashboardEntity();
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits [DashboardLoading, DashboardLoaded] on success',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => Right(entity));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
isA<DashboardLoaded>(),
|
||||
],
|
||||
verify: (_) {
|
||||
verify(mockGetDashboardData(
|
||||
const GetDashboardDataParams(
|
||||
organizationId: 'org-1',
|
||||
userId: 'user-1',
|
||||
),
|
||||
)).called(1);
|
||||
},
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits [DashboardLoading, DashboardLoaded] with correct entity',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => Right(entity));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
DashboardLoaded(entity),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits [DashboardLoading, DashboardError] on ServerFailure',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => const Left(ServerFailure('server error')));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
isA<DashboardError>(),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'error message for NetworkFailure is user-friendly',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => const Left(NetworkFailure('no internet')));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
const DashboardError(
|
||||
'Pas de connexion internet. Vérifiez votre connexion.',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'error message for UnauthorizedFailure is user-friendly',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any)).thenAnswer(
|
||||
(_) async => const Left(UnauthorizedFailure('401')));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
const DashboardError(
|
||||
'Session expirée. Veuillez vous reconnecter.',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits DashboardMemberNotRegistered on NotFoundFailure',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any)).thenAnswer(
|
||||
(_) async => const Left(
|
||||
NotFoundFailure('membre non inscrit'),
|
||||
),
|
||||
);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
isA<DashboardMemberNotRegistered>(),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'passes useGlobalDashboard flag to use case',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => Right(entity));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardData(
|
||||
organizationId: '',
|
||||
userId: 'super-admin',
|
||||
useGlobalDashboard: true,
|
||||
),
|
||||
),
|
||||
verify: (_) {
|
||||
verify(mockGetDashboardData(
|
||||
const GetDashboardDataParams(
|
||||
organizationId: '',
|
||||
userId: 'super-admin',
|
||||
useGlobalDashboard: true,
|
||||
),
|
||||
)).called(1);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// ─── RefreshDashboardData ────────────────────────────────────────────────
|
||||
|
||||
group('RefreshDashboardData', () {
|
||||
final entity = _buildDashboardEntity();
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits [DashboardLoading, DashboardLoaded] when state is not loaded',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => Right(entity));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const RefreshDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
isA<DashboardLoaded>(),
|
||||
],
|
||||
);
|
||||
|
||||
test('emits [DashboardRefreshing, DashboardLoaded] when state is DashboardLoaded', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
final states = <DashboardState>[];
|
||||
final sub = bloc.stream.listen(states.add);
|
||||
|
||||
bloc.add(const RefreshDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded || s is DashboardError);
|
||||
|
||||
await sub.cancel();
|
||||
expect(states, containsAll([isA<DashboardRefreshing>(), isA<DashboardLoaded>()]));
|
||||
|
||||
await bloc.close();
|
||||
});
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits DashboardError on failure during refresh',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => const Left(ServerFailure('err')));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const RefreshDashboardData(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [
|
||||
isA<DashboardLoading>(),
|
||||
isA<DashboardError>(),
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
// ─── LoadDashboardStats ──────────────────────────────────────────────────
|
||||
|
||||
group('LoadDashboardStats', () {
|
||||
final entity = _buildDashboardEntity();
|
||||
final stats = _buildStats();
|
||||
|
||||
// BLoC 9.x processes events concurrently. LoadDashboardStats only emits when
|
||||
// state is DashboardLoaded. We verify the use case IS called and, when the
|
||||
// state is Initial (not loaded), nothing is emitted.
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'calls getDashboardStats use case with correct params',
|
||||
build: () {
|
||||
when(mockGetDashboardData(any))
|
||||
.thenAnswer((_) async => Right(entity));
|
||||
when(mockGetDashboardStats(any))
|
||||
.thenAnswer((_) async => Right(stats));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardStats(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
verify: (_) {
|
||||
verify(mockGetDashboardStats(
|
||||
const GetDashboardStatsParams(
|
||||
organizationId: 'org-1',
|
||||
userId: 'user-1',
|
||||
),
|
||||
)).called(1);
|
||||
},
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits nothing when state is not DashboardLoaded (stats not injected)',
|
||||
build: () {
|
||||
when(mockGetDashboardStats(any))
|
||||
.thenAnswer((_) async => Right(stats));
|
||||
return buildBloc();
|
||||
},
|
||||
// state is DashboardInitial — LoadDashboardStats won't emit
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardStats(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
|
||||
// Stats failure always emits DashboardError regardless of current state
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits DashboardError on stats failure',
|
||||
build: () {
|
||||
when(mockGetDashboardStats(any))
|
||||
.thenAnswer((_) async => const Left(ServerFailure('stats error')));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadDashboardStats(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => [isA<DashboardError>()],
|
||||
);
|
||||
});
|
||||
|
||||
// ─── LoadRecentActivities ────────────────────────────────────────────────
|
||||
|
||||
group('LoadRecentActivities', () {
|
||||
final entity = _buildDashboardEntity();
|
||||
|
||||
final activity = RecentActivityEntity(
|
||||
id: 'act-1',
|
||||
type: 'contribution',
|
||||
title: 'Cotisation payée',
|
||||
description: 'Cotisation mensuelle',
|
||||
userName: 'Alice',
|
||||
timestamp: DateTime(2026, 4, 19),
|
||||
);
|
||||
|
||||
test('updates activities in DashboardLoaded on success', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
when(mockGetRecentActivities(any)).thenAnswer((_) async => Right([activity]));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
bloc.add(const LoadRecentActivities(organizationId: 'org-1', userId: 'user-1'));
|
||||
final next = await bloc.stream.firstWhere((s) => s is DashboardLoaded || s is DashboardError);
|
||||
|
||||
expect(next, isA<DashboardLoaded>());
|
||||
final loaded = next as DashboardLoaded;
|
||||
expect(loaded.dashboardData.recentActivities, [activity]);
|
||||
|
||||
await bloc.close();
|
||||
});
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'does nothing when state is not DashboardLoaded',
|
||||
build: () {
|
||||
when(mockGetRecentActivities(any))
|
||||
.thenAnswer((_) async => Right([activity]));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadRecentActivities(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
|
||||
test('emits DashboardError on failure when state is DashboardLoaded', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
when(mockGetRecentActivities(any))
|
||||
.thenAnswer((_) async => const Left(NetworkFailure('net')));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
bloc.add(const LoadRecentActivities(organizationId: 'org-1', userId: 'user-1'));
|
||||
final next = await bloc.stream.firstWhere((s) => s is DashboardError || s is DashboardLoaded);
|
||||
|
||||
expect(next, isA<DashboardError>());
|
||||
await bloc.close();
|
||||
});
|
||||
|
||||
test('passes custom limit to use case', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
when(mockGetRecentActivities(any)).thenAnswer((_) async => Right([activity]));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
bloc.add(const LoadRecentActivities(
|
||||
organizationId: 'org-1',
|
||||
userId: 'user-1',
|
||||
limit: 20,
|
||||
));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded || s is DashboardError);
|
||||
|
||||
verify(mockGetRecentActivities(
|
||||
const GetRecentActivitiesParams(
|
||||
organizationId: 'org-1',
|
||||
userId: 'user-1',
|
||||
limit: 20,
|
||||
),
|
||||
)).called(1);
|
||||
|
||||
await bloc.close();
|
||||
});
|
||||
});
|
||||
|
||||
// ─── LoadUpcomingEvents ──────────────────────────────────────────────────
|
||||
|
||||
group('LoadUpcomingEvents', () {
|
||||
final entity = _buildDashboardEntity();
|
||||
|
||||
final upcomingEvent = UpcomingEventEntity(
|
||||
id: 'evt-1',
|
||||
title: 'AG annuelle',
|
||||
description: 'Assemblée générale',
|
||||
startDate: DateTime(2026, 5, 1),
|
||||
location: 'Dakar',
|
||||
maxParticipants: 100,
|
||||
currentParticipants: 40,
|
||||
status: 'planifié',
|
||||
tags: const [],
|
||||
);
|
||||
|
||||
test('updates events in DashboardLoaded on success', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
when(mockGetUpcomingEvents(any)).thenAnswer((_) async => Right([upcomingEvent]));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
bloc.add(const LoadUpcomingEvents(organizationId: 'org-1', userId: 'user-1'));
|
||||
final next = await bloc.stream.firstWhere((s) => s is DashboardLoaded || s is DashboardError);
|
||||
|
||||
expect(next, isA<DashboardLoaded>());
|
||||
final loaded = next as DashboardLoaded;
|
||||
expect(loaded.dashboardData.upcomingEvents, [upcomingEvent]);
|
||||
|
||||
await bloc.close();
|
||||
});
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'does nothing when state is not DashboardLoaded',
|
||||
build: () {
|
||||
when(mockGetUpcomingEvents(any))
|
||||
.thenAnswer((_) async => Right([upcomingEvent]));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const LoadUpcomingEvents(organizationId: 'org-1', userId: 'user-1'),
|
||||
),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
|
||||
test('emits DashboardError on failure when state is DashboardLoaded', () async {
|
||||
when(mockGetDashboardData(any)).thenAnswer((_) async => Right(entity));
|
||||
when(mockGetUpcomingEvents(any))
|
||||
.thenAnswer((_) async => const Left(ServerFailure('err')));
|
||||
|
||||
final bloc = buildBloc();
|
||||
bloc.add(const LoadDashboardData(organizationId: 'org-1', userId: 'user-1'));
|
||||
await bloc.stream.firstWhere((s) => s is DashboardLoaded);
|
||||
|
||||
bloc.add(const LoadUpcomingEvents(organizationId: 'org-1', userId: 'user-1'));
|
||||
final next = await bloc.stream.firstWhere((s) => s is DashboardError || s is DashboardLoaded);
|
||||
|
||||
expect(next, isA<DashboardError>());
|
||||
await bloc.close();
|
||||
});
|
||||
});
|
||||
|
||||
// ─── RefreshDashboardFromWebSocket ───────────────────────────────────────
|
||||
|
||||
group('RefreshDashboardFromWebSocket', () {
|
||||
final stats = _buildStats();
|
||||
|
||||
// BLoC 9 concurrent: RefreshDashboardFromWebSocket calls getDashboardStats
|
||||
// only when state is DashboardLoaded. We verify the call is made.
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'calls getDashboardStats when triggered from WebSocket (state not loaded — no call)',
|
||||
build: () {
|
||||
when(mockGetDashboardStats(any))
|
||||
.thenAnswer((_) async => Right(stats));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const RefreshDashboardFromWebSocket({'type': 'DASHBOARD_STATS_UPDATED'}),
|
||||
),
|
||||
// state is DashboardInitial — getDashboardStats NOT called
|
||||
verify: (_) => verifyZeroInteractions(mockGetDashboardStats),
|
||||
);
|
||||
|
||||
// WebSocket refresh with failure swallows error silently
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'does not emit error when getDashboardStats fails during WebSocket refresh',
|
||||
build: () {
|
||||
when(mockGetDashboardStats(any))
|
||||
.thenAnswer((_) async => const Left(NetworkFailure('net')));
|
||||
return buildBloc();
|
||||
},
|
||||
// state is DashboardInitial — nothing happens (getDashboardStats not called)
|
||||
act: (b) => b.add(
|
||||
const RefreshDashboardFromWebSocket({'type': 'CONTRIBUTION_PAID'}),
|
||||
),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'does nothing when state is not DashboardLoaded',
|
||||
build: () {
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(
|
||||
const RefreshDashboardFromWebSocket({'type': 'DASHBOARD_STATS_UPDATED'}),
|
||||
),
|
||||
expect: () => <DashboardState>[],
|
||||
verify: (_) => verifyZeroInteractions(mockGetDashboardStats),
|
||||
);
|
||||
});
|
||||
|
||||
// ─── WebSocketConnectionChanged ──────────────────────────────────────────
|
||||
|
||||
group('WebSocketConnectionChanged', () {
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits nothing (no state change) on connected = true',
|
||||
build: buildBloc,
|
||||
act: (b) => b.add(const WebSocketConnectionChanged(true)),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
|
||||
blocTest<DashboardBloc, DashboardState>(
|
||||
'emits nothing (no state change) on connected = false',
|
||||
build: buildBloc,
|
||||
act: (b) => b.add(const WebSocketConnectionChanged(false)),
|
||||
expect: () => <DashboardState>[],
|
||||
);
|
||||
});
|
||||
|
||||
// ─── close() ─────────────────────────────────────────────────────────────
|
||||
|
||||
test('close() disconnects WebSocket', () async {
|
||||
final bloc = buildBloc();
|
||||
await bloc.close();
|
||||
verify(mockWebSocketService.disconnect()).called(1);
|
||||
});
|
||||
}
|
||||
247
test/features/dashboard/bloc/dashboard_bloc_test.mocks.dart
Normal file
247
test/features/dashboard/bloc/dashboard_bloc_test.mocks.dart
Normal file
@@ -0,0 +1,247 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in unionflow_mobile_apps/test/features/dashboard/bloc/dashboard_bloc_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i5;
|
||||
|
||||
import 'package:dartz/dartz.dart' as _i3;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:unionflow_mobile_apps/core/error/failures.dart' as _i6;
|
||||
import 'package:unionflow_mobile_apps/core/websocket/websocket_service.dart'
|
||||
as _i8;
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/domain/entities/dashboard_entity.dart'
|
||||
as _i7;
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/domain/repositories/dashboard_repository.dart'
|
||||
as _i2;
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/domain/usecases/get_dashboard_data.dart'
|
||||
as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: must_be_immutable
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeDashboardRepository_0 extends _i1.SmartFake
|
||||
implements _i2.DashboardRepository {
|
||||
_FakeDashboardRepository_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeEither_1<L, R> extends _i1.SmartFake implements _i3.Either<L, R> {
|
||||
_FakeEither_1(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [GetDashboardData].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockGetDashboardData extends _i1.Mock implements _i4.GetDashboardData {
|
||||
MockGetDashboardData() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.DashboardRepository get repository =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#repository),
|
||||
returnValue: _FakeDashboardRepository_0(
|
||||
this,
|
||||
Invocation.getter(#repository),
|
||||
),
|
||||
)
|
||||
as _i2.DashboardRepository);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.Either<_i6.Failure, _i7.DashboardEntity>> call(
|
||||
_i4.GetDashboardDataParams? params,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#call, [params]),
|
||||
returnValue:
|
||||
_i5.Future<_i3.Either<_i6.Failure, _i7.DashboardEntity>>.value(
|
||||
_FakeEither_1<_i6.Failure, _i7.DashboardEntity>(
|
||||
this,
|
||||
Invocation.method(#call, [params]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i3.Either<_i6.Failure, _i7.DashboardEntity>>);
|
||||
}
|
||||
|
||||
/// A class which mocks [GetDashboardStats].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockGetDashboardStats extends _i1.Mock implements _i4.GetDashboardStats {
|
||||
MockGetDashboardStats() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.DashboardRepository get repository =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#repository),
|
||||
returnValue: _FakeDashboardRepository_0(
|
||||
this,
|
||||
Invocation.getter(#repository),
|
||||
),
|
||||
)
|
||||
as _i2.DashboardRepository);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.Either<_i6.Failure, _i7.DashboardStatsEntity>> call(
|
||||
_i4.GetDashboardStatsParams? params,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#call, [params]),
|
||||
returnValue:
|
||||
_i5.Future<
|
||||
_i3.Either<_i6.Failure, _i7.DashboardStatsEntity>
|
||||
>.value(
|
||||
_FakeEither_1<_i6.Failure, _i7.DashboardStatsEntity>(
|
||||
this,
|
||||
Invocation.method(#call, [params]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i3.Either<_i6.Failure, _i7.DashboardStatsEntity>>);
|
||||
}
|
||||
|
||||
/// A class which mocks [GetRecentActivities].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockGetRecentActivities extends _i1.Mock
|
||||
implements _i4.GetRecentActivities {
|
||||
MockGetRecentActivities() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.DashboardRepository get repository =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#repository),
|
||||
returnValue: _FakeDashboardRepository_0(
|
||||
this,
|
||||
Invocation.getter(#repository),
|
||||
),
|
||||
)
|
||||
as _i2.DashboardRepository);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.Either<_i6.Failure, List<_i7.RecentActivityEntity>>> call(
|
||||
_i4.GetRecentActivitiesParams? params,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#call, [params]),
|
||||
returnValue:
|
||||
_i5.Future<
|
||||
_i3.Either<_i6.Failure, List<_i7.RecentActivityEntity>>
|
||||
>.value(
|
||||
_FakeEither_1<_i6.Failure, List<_i7.RecentActivityEntity>>(
|
||||
this,
|
||||
Invocation.method(#call, [params]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<
|
||||
_i3.Either<_i6.Failure, List<_i7.RecentActivityEntity>>
|
||||
>);
|
||||
}
|
||||
|
||||
/// A class which mocks [GetUpcomingEvents].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockGetUpcomingEvents extends _i1.Mock implements _i4.GetUpcomingEvents {
|
||||
MockGetUpcomingEvents() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.DashboardRepository get repository =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#repository),
|
||||
returnValue: _FakeDashboardRepository_0(
|
||||
this,
|
||||
Invocation.getter(#repository),
|
||||
),
|
||||
)
|
||||
as _i2.DashboardRepository);
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.Either<_i6.Failure, List<_i7.UpcomingEventEntity>>> call(
|
||||
_i4.GetUpcomingEventsParams? params,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#call, [params]),
|
||||
returnValue:
|
||||
_i5.Future<
|
||||
_i3.Either<_i6.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>.value(
|
||||
_FakeEither_1<_i6.Failure, List<_i7.UpcomingEventEntity>>(
|
||||
this,
|
||||
Invocation.method(#call, [params]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<
|
||||
_i3.Either<_i6.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>);
|
||||
}
|
||||
|
||||
/// A class which mocks [WebSocketService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWebSocketService extends _i1.Mock implements _i8.WebSocketService {
|
||||
MockWebSocketService() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Stream<_i8.WebSocketEvent> get eventStream =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#eventStream),
|
||||
returnValue: _i5.Stream<_i8.WebSocketEvent>.empty(),
|
||||
)
|
||||
as _i5.Stream<_i8.WebSocketEvent>);
|
||||
|
||||
@override
|
||||
_i5.Stream<bool> get connectionStatusStream =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#connectionStatusStream),
|
||||
returnValue: _i5.Stream<bool>.empty(),
|
||||
)
|
||||
as _i5.Stream<bool>);
|
||||
|
||||
@override
|
||||
bool get isConnected =>
|
||||
(super.noSuchMethod(Invocation.getter(#isConnected), returnValue: false)
|
||||
as bool);
|
||||
|
||||
@override
|
||||
void connect() => super.noSuchMethod(
|
||||
Invocation.method(#connect, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void disconnect() => super.noSuchMethod(
|
||||
Invocation.method(#disconnect, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() => super.noSuchMethod(
|
||||
Invocation.method(#dispose, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
}
|
||||
294
test/features/dashboard/bloc/finance_bloc_test.dart
Normal file
294
test/features/dashboard/bloc/finance_bloc_test.dart
Normal file
@@ -0,0 +1,294 @@
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/data/repositories/finance_repository.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/presentation/bloc/finance_bloc.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/presentation/bloc/finance_event.dart';
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/presentation/bloc/finance_state.dart';
|
||||
|
||||
@GenerateMocks([FinanceRepository])
|
||||
import 'finance_bloc_test.mocks.dart';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Fixtures
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const _summary = FinanceSummary(
|
||||
totalContributionsPaid: 150000,
|
||||
totalContributionsPending: 25000,
|
||||
epargneBalance: 300000,
|
||||
);
|
||||
|
||||
final _transactions = [
|
||||
const FinanceTransaction(
|
||||
id: 'tx-1',
|
||||
title: 'Cotisation Janvier',
|
||||
date: '01/01/2026',
|
||||
amount: 5000,
|
||||
status: 'En attente',
|
||||
),
|
||||
const FinanceTransaction(
|
||||
id: 'tx-2',
|
||||
title: 'Cotisation Février',
|
||||
date: '01/02/2026',
|
||||
amount: 5000,
|
||||
status: 'Payé',
|
||||
),
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void main() {
|
||||
late MockFinanceRepository mockRepository;
|
||||
|
||||
setUp(() {
|
||||
mockRepository = MockFinanceRepository();
|
||||
});
|
||||
|
||||
FinanceBloc buildBloc() => FinanceBloc(mockRepository);
|
||||
|
||||
// ─── initial state ───────────────────────────────────────────────────────
|
||||
|
||||
test('initial state is FinanceInitial', () {
|
||||
final bloc = buildBloc();
|
||||
expect(bloc.state, isA<FinanceInitial>());
|
||||
bloc.close();
|
||||
});
|
||||
|
||||
// ─── LoadFinanceRequested ────────────────────────────────────────────────
|
||||
|
||||
group('LoadFinanceRequested', () {
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'emits [FinanceLoading, FinanceLoaded] on success',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenAnswer((_) async => _summary);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => _transactions);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
isA<FinanceLoaded>(),
|
||||
],
|
||||
verify: (_) {
|
||||
verify(mockRepository.getFinancialSummary()).called(1);
|
||||
verify(mockRepository.getTransactions()).called(1);
|
||||
},
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'FinanceLoaded contains correct summary and transactions',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenAnswer((_) async => _summary);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => _transactions);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
FinanceLoaded(summary: _summary, transactions: _transactions),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'emits [FinanceLoading, FinanceLoaded] with empty transactions list',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenAnswer((_) async => _summary);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => []);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
const FinanceLoaded(summary: _summary, transactions: []),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'emits [FinanceLoading, FinanceError] when getFinancialSummary throws',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenThrow(Exception('network error'));
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => []);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
isA<FinanceError>(),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'emits [FinanceLoading, FinanceError] when getTransactions throws',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenAnswer((_) async => _summary);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenThrow(Exception('transactions error'));
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
isA<FinanceError>(),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'FinanceError message contains error information',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenThrow(Exception('server down'));
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => []);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
predicate<FinanceState>(
|
||||
(s) => s is FinanceError && s.message.contains('Erreur chargement'),
|
||||
'FinanceError with expected prefix',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'does NOT emit error when DioException type is cancel',
|
||||
build: () {
|
||||
final dioException = DioException(
|
||||
requestOptions: RequestOptions(path: '/test'),
|
||||
type: DioExceptionType.cancel,
|
||||
);
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenThrow(dioException);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => []);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) => b.add(LoadFinanceRequested()),
|
||||
// Only FinanceLoading emitted; the cancel exception is swallowed
|
||||
expect: () => [isA<FinanceLoading>()],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'handles multiple consecutive LoadFinanceRequested events',
|
||||
build: () {
|
||||
when(mockRepository.getFinancialSummary())
|
||||
.thenAnswer((_) async => _summary);
|
||||
when(mockRepository.getTransactions())
|
||||
.thenAnswer((_) async => _transactions);
|
||||
return buildBloc();
|
||||
},
|
||||
act: (b) async {
|
||||
b.add(LoadFinanceRequested());
|
||||
// Wait for the first load to complete before firing the second
|
||||
await b.stream.firstWhere((s) => s is FinanceLoaded);
|
||||
b.add(LoadFinanceRequested());
|
||||
},
|
||||
expect: () => [
|
||||
isA<FinanceLoading>(),
|
||||
isA<FinanceLoaded>(),
|
||||
isA<FinanceLoading>(),
|
||||
isA<FinanceLoaded>(),
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
// ─── FinancePaymentInitiated ─────────────────────────────────────────────
|
||||
|
||||
group('FinancePaymentInitiated', () {
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'does not change state when current state is FinanceInitial',
|
||||
build: buildBloc,
|
||||
act: (b) => b.add(const FinancePaymentInitiated('contrib-1')),
|
||||
expect: () => <FinanceState>[],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'does not change state when current state is FinanceLoaded (no-op for now)',
|
||||
build: () {
|
||||
// No repository calls needed — the handler is a no-op when loaded
|
||||
return buildBloc();
|
||||
},
|
||||
seed: () =>
|
||||
FinanceLoaded(summary: _summary, transactions: _transactions),
|
||||
act: (b) =>
|
||||
b.add(const FinancePaymentInitiated('contrib-42')),
|
||||
// The bloc intentionally keeps FinanceLoaded unchanged
|
||||
expect: () => <FinanceState>[],
|
||||
);
|
||||
|
||||
blocTest<FinanceBloc, FinanceState>(
|
||||
'does not call any repository method',
|
||||
build: buildBloc,
|
||||
act: (b) => b.add(const FinancePaymentInitiated('contrib-1')),
|
||||
verify: (_) {
|
||||
verifyZeroInteractions(mockRepository);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// ─── State equality ──────────────────────────────────────────────────────
|
||||
|
||||
group('State equality', () {
|
||||
test('FinanceSummary equality works correctly', () {
|
||||
const s1 = FinanceSummary(
|
||||
totalContributionsPaid: 100,
|
||||
totalContributionsPending: 50,
|
||||
epargneBalance: 200,
|
||||
);
|
||||
const s2 = FinanceSummary(
|
||||
totalContributionsPaid: 100,
|
||||
totalContributionsPending: 50,
|
||||
epargneBalance: 200,
|
||||
);
|
||||
expect(s1, equals(s2));
|
||||
});
|
||||
|
||||
test('FinanceTransaction equality works correctly', () {
|
||||
const tx1 = FinanceTransaction(
|
||||
id: 'tx-1',
|
||||
title: 'Title',
|
||||
date: '01/01/2026',
|
||||
amount: 5000,
|
||||
status: 'Payé',
|
||||
);
|
||||
const tx2 = FinanceTransaction(
|
||||
id: 'tx-1',
|
||||
title: 'Title',
|
||||
date: '01/01/2026',
|
||||
amount: 5000,
|
||||
status: 'Payé',
|
||||
);
|
||||
expect(tx1, equals(tx2));
|
||||
});
|
||||
|
||||
test('FinanceLoaded equality works correctly', () {
|
||||
final l1 =
|
||||
FinanceLoaded(summary: _summary, transactions: _transactions);
|
||||
final l2 =
|
||||
FinanceLoaded(summary: _summary, transactions: _transactions);
|
||||
expect(l1, equals(l2));
|
||||
});
|
||||
|
||||
test('FinanceError equality works correctly', () {
|
||||
const e1 = FinanceError('some error');
|
||||
const e2 = FinanceError('some error');
|
||||
expect(e1, equals(e2));
|
||||
});
|
||||
});
|
||||
}
|
||||
65
test/features/dashboard/bloc/finance_bloc_test.mocks.dart
Normal file
65
test/features/dashboard/bloc/finance_bloc_test.mocks.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in unionflow_mobile_apps/test/features/dashboard/bloc/finance_bloc_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/data/repositories/finance_repository.dart'
|
||||
as _i3;
|
||||
import 'package:unionflow_mobile_apps/features/dashboard/presentation/bloc/finance_state.dart'
|
||||
as _i2;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: must_be_immutable
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeFinanceSummary_0 extends _i1.SmartFake
|
||||
implements _i2.FinanceSummary {
|
||||
_FakeFinanceSummary_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [FinanceRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockFinanceRepository extends _i1.Mock implements _i3.FinanceRepository {
|
||||
MockFinanceRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.FinanceSummary> getFinancialSummary() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getFinancialSummary, []),
|
||||
returnValue: _i4.Future<_i2.FinanceSummary>.value(
|
||||
_FakeFinanceSummary_0(
|
||||
this,
|
||||
Invocation.method(#getFinancialSummary, []),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.FinanceSummary>);
|
||||
|
||||
@override
|
||||
_i4.Future<List<_i2.FinanceTransaction>> getTransactions() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getTransactions, []),
|
||||
returnValue: _i4.Future<List<_i2.FinanceTransaction>>.value(
|
||||
<_i2.FinanceTransaction>[],
|
||||
),
|
||||
)
|
||||
as _i4.Future<List<_i2.FinanceTransaction>>);
|
||||
}
|
||||
@@ -31,13 +31,8 @@ import 'package:unionflow_mobile_apps/features/dashboard/domain/repositories/das
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeEither_0<L, R> extends _i1.SmartFake implements _i2.Either<L, R> {
|
||||
_FakeEither_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
_FakeEither_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [DashboardRepository].
|
||||
@@ -51,21 +46,20 @@ class MockDashboardRepository extends _i1.Mock
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>
|
||||
getCompteAdherent() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getCompteAdherent,
|
||||
[],
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i6.CompteAdherentEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getCompteAdherent,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>);
|
||||
getCompteAdherent() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getCompteAdherent, []),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, _i6.CompteAdherentEntity>(
|
||||
this,
|
||||
Invocation.method(#getCompteAdherent, []),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>> getDashboardData(
|
||||
@@ -74,118 +68,100 @@ class MockDashboardRepository extends _i1.Mock
|
||||
bool? useGlobalDashboard = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>);
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[organizationId, userId],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[organizationId, userId],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>> getDashboardStats(
|
||||
String? organizationId,
|
||||
String? userId,
|
||||
) =>
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>
|
||||
getDashboardStats(String? organizationId, String? userId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDashboardStats,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardStatsEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardStats,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>);
|
||||
Invocation.method(#getDashboardStats, [organizationId, userId]),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardStatsEntity>(
|
||||
this,
|
||||
Invocation.method(#getDashboardStats, [
|
||||
organizationId,
|
||||
userId,
|
||||
]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>
|
||||
getRecentActivities(
|
||||
getRecentActivities(
|
||||
String? organizationId,
|
||||
String? userId, {
|
||||
int? limit = 10,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2
|
||||
.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.RecentActivityEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
)),
|
||||
) as _i4
|
||||
.Future<_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>);
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.RecentActivityEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>
|
||||
>);
|
||||
|
||||
@override
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>> getUpcomingEvents(
|
||||
String? organizationId,
|
||||
String? userId, {
|
||||
int? limit = 5,
|
||||
}) =>
|
||||
_i4.Future<_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>
|
||||
getUpcomingEvents(String? organizationId, String? userId, {int? limit = 5}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.UpcomingEventEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>);
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.UpcomingEventEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>);
|
||||
}
|
||||
|
||||
@@ -31,13 +31,8 @@ import 'package:unionflow_mobile_apps/features/dashboard/domain/repositories/das
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeEither_0<L, R> extends _i1.SmartFake implements _i2.Either<L, R> {
|
||||
_FakeEither_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
_FakeEither_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [DashboardRepository].
|
||||
@@ -51,21 +46,20 @@ class MockDashboardRepository extends _i1.Mock
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>
|
||||
getCompteAdherent() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getCompteAdherent,
|
||||
[],
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i6.CompteAdherentEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getCompteAdherent,
|
||||
[],
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>);
|
||||
getCompteAdherent() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getCompteAdherent, []),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, _i6.CompteAdherentEntity>(
|
||||
this,
|
||||
Invocation.method(#getCompteAdherent, []),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i6.CompteAdherentEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>> getDashboardData(
|
||||
@@ -74,118 +68,100 @@ class MockDashboardRepository extends _i1.Mock
|
||||
bool? useGlobalDashboard = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>);
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[organizationId, userId],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardData,
|
||||
[organizationId, userId],
|
||||
{#useGlobalDashboard: useGlobalDashboard},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>> getDashboardStats(
|
||||
String? organizationId,
|
||||
String? userId,
|
||||
) =>
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>
|
||||
getDashboardStats(String? organizationId, String? userId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDashboardStats,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardStatsEntity>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getDashboardStats,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>);
|
||||
Invocation.method(#getDashboardStats, [organizationId, userId]),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, _i7.DashboardStatsEntity>(
|
||||
this,
|
||||
Invocation.method(#getDashboardStats, [
|
||||
organizationId,
|
||||
userId,
|
||||
]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Either<_i5.Failure, _i7.DashboardStatsEntity>>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>
|
||||
getRecentActivities(
|
||||
getRecentActivities(
|
||||
String? organizationId,
|
||||
String? userId, {
|
||||
int? limit = 10,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2
|
||||
.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.RecentActivityEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
)),
|
||||
) as _i4
|
||||
.Future<_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>>);
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.RecentActivityEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getRecentActivities,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.RecentActivityEntity>>
|
||||
>);
|
||||
|
||||
@override
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>> getUpcomingEvents(
|
||||
String? organizationId,
|
||||
String? userId, {
|
||||
int? limit = 5,
|
||||
}) =>
|
||||
_i4.Future<_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>
|
||||
getUpcomingEvents(String? organizationId, String? userId, {int? limit = 5}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue: _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.UpcomingEventEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[
|
||||
organizationId,
|
||||
userId,
|
||||
],
|
||||
{#limit: limit},
|
||||
),
|
||||
)),
|
||||
) as _i4.Future<_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>>);
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
returnValue:
|
||||
_i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>.value(
|
||||
_FakeEither_0<_i5.Failure, List<_i7.UpcomingEventEntity>>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getUpcomingEvents,
|
||||
[organizationId, userId],
|
||||
{#limit: limit},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i4.Future<
|
||||
_i2.Either<_i5.Failure, List<_i7.UpcomingEventEntity>>
|
||||
>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user