test: Cover bad request responses for API endpoint tests
This commit is contained in:
@@ -33,14 +33,25 @@ describe('GET /api/v1/admin/saml-auth-provider/:samlAuthProviderId', () => {
|
||||
expect(response.body).toEqual(expectedPayload);
|
||||
});
|
||||
|
||||
it('should return not found response for not existing saml auth provider ID', async () => {
|
||||
it('should return not found response for not existing saml auth provider UUID', async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
const invalidSamlAuthProviderId = Crypto.randomUUID();
|
||||
const notExistingSamlAuthProviderUUID = Crypto.randomUUID();
|
||||
|
||||
await request(app)
|
||||
.get(`/api/v1/admin/saml-auth-providers/${invalidSamlAuthProviderId}`)
|
||||
.get(
|
||||
`/api/v1/admin/saml-auth-providers/${notExistingSamlAuthProviderUUID}`
|
||||
)
|
||||
.set('Authorization', token)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('should return bad request response for invalid UUID', async () => {
|
||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||
|
||||
await request(app)
|
||||
.get('/api/v1/admin/saml-auth-providers/invalidSamlAuthProviderUUID')
|
||||
.set('Authorization', token)
|
||||
.expect(400);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user