diff --git a/test/service_tests/event_service_test.dart b/test/service_tests/event_service_test.dart index 4f1087fe9..8b8d02d64 100644 --- a/test/service_tests/event_service_test.dart +++ b/test/service_tests/event_service_test.dart @@ -417,7 +417,7 @@ void main() { ); }); - test('Test fetchVolunteerGroupsByEvent method', () async { + test('Test fetchVolunteerGroupsByEvent method success', () async { final dataBaseMutationFunctions = locator(); const query = ''; const eventId = 'eventId123'; @@ -457,6 +457,29 @@ void main() { expect(result[0].id, 'groupId1'); expect(result[1].id, 'groupId2'); }); + test('Test fetchVolunteerGroupsByEvent method failure', () async { + final dataBaseMutationFunctions = locator(); + const eventId = 'eventId123'; + when( + dataBaseMutationFunctions.gqlAuthQuery( + EventQueries().fetchVolunteerGroups(), + variables: { + "where": {"eventId": eventId}, + }, + ), + ).thenThrow( + Exception("query error"), + ); + + final service = EventService(); + + try { + await service.fetchVolunteerGroupsByEvent(eventId); + } catch (e) { + expect(e, isA()); + expect(e.toString(), equals('Exception: query error')); + } + }); test('fetchAgendaCategories returns correct data', () async { const orgId = 'org123'; final mockResult = QueryResult(