refactor(create-config): move unique violation error handling to error-handler

This commit is contained in:
Ali BARIN
2024-08-27 16:30:05 +00:00
parent 48b2b006c0
commit 0800642a2a
5 changed files with 55 additions and 30 deletions

View File

@@ -23,7 +23,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
it('should return created response for valid app config', async () => {
await createAppConfig({
key: 'gitlab'
key: 'gitlab',
});
const appAuthClient = {
@@ -35,7 +35,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
clientSecret: 'sample client secret',
instanceUrl: 'https://gitlab.com',
oAuthRedirectUrl: 'http://localhost:3001/app/gitlab/connection/add',
}
},
};
const response = await request(app)
@@ -58,7 +58,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
clientSecret: 'sample client secret',
instanceUrl: 'https://gitlab.com',
oAuthRedirectUrl: 'http://localhost:3001/app/gitlab/connection/add',
}
},
};
await request(app)
@@ -70,7 +70,7 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
it('should return bad request response for missing required fields', async () => {
await createAppConfig({
key: 'gitlab'
key: 'gitlab',
});
const appAuthClient = {
@@ -86,7 +86,9 @@ describe('POST /api/v1/admin/apps/:appKey/auth-clients', () => {
expect(response.body.meta.type).toEqual('ModelValidation');
expect(response.body.errors).toMatchObject({
name: ["must have required property 'name'"],
formattedAuthDefaults: ["must have required property 'formattedAuthDefaults'"]
formattedAuthDefaults: [
"must have required property 'formattedAuthDefaults'",
],
});
});
});