Skip to content

Commit

Permalink
test: add coverage to listReleases and listRepositories
Browse files Browse the repository at this point in the history
  • Loading branch information
chfleury committed Aug 2, 2024
1 parent fd5083f commit 2452ee0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions __tests__/request_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,26 @@ describe('RequestService', () => {
await expect(listOrganizationsExecution).rejects.toThrow(errorMsg);
});

test('should throw an error if listRepositories API call returns no data', async () => {
const errorMsg = "No data received from the API.";

mockAxios.onGet().reply(() => [500, { message: 'API Error' }]);

const result = service.listRepositories(1, 1);

await expect(result).rejects.toThrow(errorMsg);
});

test('should throw an error if listReleases API call returns no data', async () => {
const errorMsg = "No data received from the API.";

mockAxios.onGet().reply(() => [500, { message: 'API Error' }]);

const result = service.listReleases(1, 1);

await expect(result).rejects.toThrow(errorMsg);
});

test('should throw error in case no data received from the API in listReleases', async () => {
const errorMsg = 'No data received from the API.';

Expand Down

0 comments on commit 2452ee0

Please sign in to comment.