test: fix group sync test mocks to match API format

main
borja (aider) 3 months ago
parent 99b4845a8f
commit ff82f62659

@ -15,11 +15,14 @@ describe('GroupSyncService', () => {
// Setup mock fetch
fetchMock = mock(async () => ({
ok: true,
json: async () => [
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');
});

Loading…
Cancel
Save