refactor: Rename AppAuthClient model as OAuthClient
This commit is contained in:
21
packages/backend/test/factories/oauth-client.js
Normal file
21
packages/backend/test/factories/oauth-client.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import OAuthClient from '../../src/models/oauth-client';
|
||||
|
||||
const formattedAuthDefaults = {
|
||||
oAuthRedirectUrl: faker.internet.url(),
|
||||
instanceUrl: faker.internet.url(),
|
||||
clientId: faker.string.uuid(),
|
||||
clientSecret: faker.string.uuid(),
|
||||
};
|
||||
|
||||
export const createOAuthClient = async (params = {}) => {
|
||||
params.name = params?.name || faker.person.fullName();
|
||||
params.appKey = params?.appKey || 'deepl';
|
||||
params.active = params?.active ?? true;
|
||||
params.formattedAuthDefaults =
|
||||
params?.formattedAuthDefaults || formattedAuthDefaults;
|
||||
|
||||
const oauthClient = await OAuthClient.query().insertAndFetch(params);
|
||||
|
||||
return oauthClient;
|
||||
};
|
||||
Reference in New Issue
Block a user