feat: Implement comprehensive navigation logic for various notification types within the NotificationWidget.

This commit is contained in:
mso7nueh
2026-02-12 11:25:06 +03:00
committed by misha
parent b7804db49d
commit bb97c395dd
16 changed files with 1211 additions and 106 deletions

View File

@@ -101,7 +101,7 @@ void main() {
registerMocks(cubit, commentsCubit);
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false)));
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false, highlightedCommentId: null)));
await tester.pump();
expect(find.byType(AboutDietScreen), findsOneWidget);
@@ -127,7 +127,7 @@ void main() {
registerMocks(cubit, commentsCubit);
await mockNetworkImagesFor(() async {
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false)));
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false, highlightedCommentId: null)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 600));
});
@@ -157,7 +157,7 @@ void main() {
registerMocks(cubit, commentsCubit);
await mockNetworkImagesFor(() async {
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false)));
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false, highlightedCommentId: null)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 600));
});
@@ -183,7 +183,7 @@ void main() {
registerMocks(cubit, commentsCubit);
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false)));
await tester.pumpWidget(wrap(cubit, feedCubit, commentsCubit, const AboutDietScreen(slug: 'test', id: null, index: null, navigateToComments: false, highlightedCommentId: null)));
await tester.pump();
expect(find.byType(AboutDietScreen), findsOneWidget);

View File

@@ -124,7 +124,7 @@ void main() {
});
test('UnknownNotification uses default createdAt when not provided', () {
final notification = UnknownNotification(type: NotificationType.unknown);
final notification = UnknownNotification(type: NotificationType.unknown, createdAt: DateTime.now());
expect(notification.type, NotificationType.unknown);
expect(notification.isRead, true);

View File

@@ -160,6 +160,8 @@ void main() {
type: NotificationType.chosenPlanStartedToConsultant,
planName: 'Test Plan',
customerName: 'Test Customer',
planId: 1,
customerId: 1,
isRead: false,
createdAt: testDate,
);
@@ -586,6 +588,8 @@ void main() {
type: NotificationType.stayOnTrackToAuthor,
planName: 'Test Plan',
clientName: 'Test Client',
planId: 1,
clientId: 1,
isRead: false,
createdAt: testDate,
);
@@ -752,6 +756,8 @@ void main() {
type: NotificationType.stayOnTrackToCustomer,
planName: 'Test Plan',
consultantName: 'Test Consultant',
planId: 1,
consultantId: 1,
isRead: false,
createdAt: testDate,
);

View File

@@ -123,7 +123,7 @@ void main() {
registerMocks(planCubit, commentsCubit);
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null)));
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null, highlightedCommentId: null)));
await tester.pump();
expect(find.byType(AboutPlanScreen), findsOneWidget);
@@ -149,7 +149,7 @@ void main() {
registerMocks(planCubit, commentsCubit);
await mockNetworkImagesFor(() async {
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null)));
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null, highlightedCommentId: null)));
await tester.pump();
await tester.pump();
});
@@ -177,7 +177,7 @@ void main() {
registerMocks(planCubit, commentsCubit);
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null)));
await tester.pumpWidget(wrap(planCubit, feedCubit, commentsCubit, const AboutPlanScreen(slug: 'test', navigateToComments: false, index: null, highlightedCommentId: null)));
await tester.pump();
expect(find.byType(AboutPlanScreen), findsOneWidget);