diff --git a/tests/unit/services/group-sync.test.ts b/tests/unit/services/group-sync.test.ts index e69fdcc..defc4d2 100644 --- a/tests/unit/services/group-sync.test.ts +++ b/tests/unit/services/group-sync.test.ts @@ -15,11 +15,14 @@ describe('GroupSyncService', () => { // Setup mock fetch fetchMock = mock(async () => ({ ok: true, - json: async () => [ - { id: 'group1', subject: 'Group 1', linkedParent: 'test-community' }, - { id: 'group2', subject: 'Group 2', linkedParent: 'other-community' }, - { id: 'group3', subject: 'Group 3' } // No linkedParent - ] + json: async () => ({ + status: 'success', + response: [ + { id: 'group1', subject: 'Group 1', linkedParent: 'test-community' }, + { id: 'group2', subject: 'Group 2', linkedParent: 'other-community' }, + { id: 'group3', subject: 'Group 3' } // No linkedParent + ] + }) })); globalThis.fetch = fetchMock; @@ -86,7 +89,8 @@ describe('GroupSyncService', () => { it('should handle API errors', async () => { globalThis.fetch = mock(async () => ({ ok: false, - statusText: 'Not Found' + statusText: 'Not Found', + json: async () => ({ status: 'error', message: 'Not Found' }) })); await expect(GroupSyncService.syncGroups()).rejects.toThrow('API request failed: Not Found'); });