refactor: Rename AppAuthClient model as OAuthClient
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
const appAuthClientSerializer = (appAuthClient) => {
|
||||
return {
|
||||
id: appAuthClient.id,
|
||||
appConfigId: appAuthClient.appConfigId,
|
||||
name: appAuthClient.name,
|
||||
active: appAuthClient.active,
|
||||
};
|
||||
};
|
||||
|
||||
export default appAuthClientSerializer;
|
||||
@@ -1,24 +0,0 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { createAppAuthClient } from '../../test/factories/app-auth-client';
|
||||
import appAuthClientSerializer from './app-auth-client';
|
||||
|
||||
describe('appAuthClient serializer', () => {
|
||||
let appAuthClient;
|
||||
|
||||
beforeEach(async () => {
|
||||
appAuthClient = await createAppAuthClient();
|
||||
});
|
||||
|
||||
it('should return app auth client data', async () => {
|
||||
const expectedPayload = {
|
||||
id: appAuthClient.id,
|
||||
appConfigId: appAuthClient.appConfigId,
|
||||
name: appAuthClient.name,
|
||||
active: appAuthClient.active,
|
||||
};
|
||||
|
||||
expect(appAuthClientSerializer(appAuthClient)).toStrictEqual(
|
||||
expectedPayload
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -2,7 +2,7 @@ const connectionSerializer = (connection) => {
|
||||
return {
|
||||
id: connection.id,
|
||||
key: connection.key,
|
||||
appAuthClientId: connection.appAuthClientId,
|
||||
oauthClientId: connection.oauthClientId,
|
||||
formattedData: {
|
||||
screenName: connection.formattedData.screenName,
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('connectionSerializer', () => {
|
||||
const expectedPayload = {
|
||||
id: connection.id,
|
||||
key: connection.key,
|
||||
appAuthClientId: connection.appAuthClientId,
|
||||
oauthClientId: connection.oauthClientId,
|
||||
formattedData: {
|
||||
screenName: connection.formattedData.screenName,
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import permissionSerializer from './permission.js';
|
||||
import adminSamlAuthProviderSerializer from './admin-saml-auth-provider.ee.js';
|
||||
import samlAuthProviderSerializer from './saml-auth-provider.ee.js';
|
||||
import samlAuthProviderRoleMappingSerializer from './role-mapping.ee.js';
|
||||
import appAuthClientSerializer from './app-auth-client.js';
|
||||
import oauthClientSerializer from './oauth-client.js';
|
||||
import appConfigSerializer from './app-config.js';
|
||||
import flowSerializer from './flow.js';
|
||||
import stepSerializer from './step.js';
|
||||
@@ -28,7 +28,7 @@ const serializers = {
|
||||
AdminSamlAuthProvider: adminSamlAuthProviderSerializer,
|
||||
SamlAuthProvider: samlAuthProviderSerializer,
|
||||
RoleMapping: samlAuthProviderRoleMappingSerializer,
|
||||
AppAuthClient: appAuthClientSerializer,
|
||||
OAuthClient: oauthClientSerializer,
|
||||
AppConfig: appConfigSerializer,
|
||||
Flow: flowSerializer,
|
||||
Step: stepSerializer,
|
||||
|
||||
10
packages/backend/src/serializers/oauth-client.js
Normal file
10
packages/backend/src/serializers/oauth-client.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const oauthClientSerializer = (oauthClient) => {
|
||||
return {
|
||||
id: oauthClient.id,
|
||||
appConfigId: oauthClient.appConfigId,
|
||||
name: oauthClient.name,
|
||||
active: oauthClient.active,
|
||||
};
|
||||
};
|
||||
|
||||
export default oauthClientSerializer;
|
||||
22
packages/backend/src/serializers/oauth-client.test.js
Normal file
22
packages/backend/src/serializers/oauth-client.test.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { createOAuthClient } from '../../test/factories/oauth-client';
|
||||
import oauthClientSerializer from './oauth-client';
|
||||
|
||||
describe('oauthClient serializer', () => {
|
||||
let oauthClient;
|
||||
|
||||
beforeEach(async () => {
|
||||
oauthClient = await createOAuthClient();
|
||||
});
|
||||
|
||||
it('should return oauth client data', async () => {
|
||||
const expectedPayload = {
|
||||
id: oauthClient.id,
|
||||
appConfigId: oauthClient.appConfigId,
|
||||
name: oauthClient.name,
|
||||
active: oauthClient.active,
|
||||
};
|
||||
|
||||
expect(oauthClientSerializer(oauthClient)).toStrictEqual(expectedPayload);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user