Skip to content
Snippets Groups Projects
Commit c2f18e47 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(ruby): datasource throw if empty

parent 1408bb4b
Branches
Tags
No related merge requests found
...@@ -39,6 +39,6 @@ async function getPkgReleases() { ...@@ -39,6 +39,6 @@ async function getPkgReleases() {
throw new Error('registry-failure'); throw new Error('registry-failure');
} }
logger.warn({ err }, 'Ruby release lookup failure: Unknown error'); logger.warn({ err }, 'Ruby release lookup failure: Unknown error');
return null; throw new Error('registry-failure');
} }
} }
...@@ -18,9 +18,15 @@ describe('datasource/gradle', () => { ...@@ -18,9 +18,15 @@ describe('datasource/gradle', () => {
const res = await getPkgReleases(); const res = await getPkgReleases();
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
}); });
it('returns null for empty result', async () => { it('throws for empty result', async () => {
got.mockReturnValueOnce({ body: {} }); got.mockReturnValueOnce({ body: {} });
expect(await getPkgReleases()).toBeNull(); let e;
try {
await getPkgReleases();
} catch (err) {
e = err;
}
expect(e).toBeDefined();
}); });
it('throws for 404', async () => { it('throws for 404', async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment