TF-2838 calendar event reject repo implementation
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:jmap_dart_client/jmap/account_id.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_maybe_response.dart';
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_maybe_response.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_reject_response.dart';
|
||||||
import 'package:tmail_ui_user/features/email/data/datasource/calendar_event_datasource.dart';
|
import 'package:tmail_ui_user/features/email/data/datasource/calendar_event_datasource.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
import 'package:tmail_ui_user/features/email/domain/repository/calendar_event_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/model/blob_calendar_event.dart';
|
import 'package:tmail_ui_user/features/email/presentation/model/blob_calendar_event.dart';
|
||||||
@@ -28,4 +29,9 @@ class CalendarEventRepositoryImpl extends CalendarEventRepository {
|
|||||||
Future<CalendarEventMaybeResponse> maybeEventInvitation(AccountId accountId, Set<Id> blobIds) {
|
Future<CalendarEventMaybeResponse> maybeEventInvitation(AccountId accountId, Set<Id> blobIds) {
|
||||||
return _calendarEventDataSource[DataSourceType.network]!.maybeEventInvitation(accountId, blobIds);
|
return _calendarEventDataSource[DataSourceType.network]!.maybeEventInvitation(accountId, blobIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<CalendarEventRejectResponse> rejectEventInvitation(AccountId accountId, Set<Id> blobIds) {
|
||||||
|
return _calendarEventDataSource[DataSourceType.network]!.rejectEventInvitation(accountId, blobIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import 'package:jmap_dart_client/jmap/core/id.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/mail/calendar/properties/event_id.dart';
|
import 'package:jmap_dart_client/jmap/mail/calendar/properties/event_id.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_accept_response.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_maybe_response.dart';
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_maybe_response.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/reply/calendar_event_reject_response.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:tmail_ui_user/features/email/data/datasource/calendar_event_datasource.dart';
|
import 'package:tmail_ui_user/features/email/data/datasource/calendar_event_datasource.dart';
|
||||||
@@ -81,4 +82,34 @@ void main() {
|
|||||||
throwsA(isA<NotMaybeableCalendarEventException>()));
|
throwsA(isA<NotMaybeableCalendarEventException>()));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('calendar event reject repository test:', () {
|
||||||
|
final calendarEventRejectResponseresponse = CalendarEventRejectResponse(
|
||||||
|
accountId,
|
||||||
|
null,
|
||||||
|
rejected: [EventId(blobId.value)]);
|
||||||
|
|
||||||
|
test('should return response when data source return response', () async {
|
||||||
|
// arrange
|
||||||
|
when(calendarEventNetworkDataSource.rejectEventInvitation(any, any))
|
||||||
|
.thenAnswer((_) async => calendarEventRejectResponseresponse);
|
||||||
|
|
||||||
|
// act
|
||||||
|
final response = await calendarEventRepository.rejectEventInvitation(accountId, {blobId});
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(response, calendarEventRejectResponseresponse);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should throw exception when data source throw exception', () {
|
||||||
|
// arrange
|
||||||
|
when(calendarEventNetworkDataSource.rejectEventInvitation(any, any))
|
||||||
|
.thenThrow(NotRejectableCalendarEventException());
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(
|
||||||
|
() => calendarEventRepository.rejectEventInvitation(accountId, {blobId}),
|
||||||
|
throwsA(isA<NotRejectableCalendarEventException>()));
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user