Add test for unexpected error

Signed-off-by: Taras <tarasm@gmail.com>
This commit is contained in:
Taras
2022-09-08 11:55:08 -04:00
parent afcafda620
commit c5cf37026e
@@ -356,5 +356,26 @@ describe('CatalogClient', () => {
valid: true,
});
});
it('throws unexpected error', async () => {
server.use(
rest.post(`${mockBaseUrl}/validate-entity`, (_req, res, ctx) => {
return res(ctx.status(500), ctx.json({}));
}),
);
await expect(() =>
client.validateEntity(
{
apiVersion: '1',
kind: 'Component',
metadata: {
name: 'good',
},
},
'http://example.com',
),
).rejects.toThrow(/Request failed with 500 Error/);
});
});
});