mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -05:00
refactor(core): remove unnecessary check in github and aliyun-sms connector (#329)
This commit is contained in:
parent
3dd7d496ef
commit
c42b2a5a67
3 changed files with 1 additions and 12 deletions
|
@ -68,10 +68,6 @@ const configGuard = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const validateConfig: ValidateConfig = async (config: unknown) => {
|
export const validateConfig: ValidateConfig = async (config: unknown) => {
|
||||||
if (!config) {
|
|
||||||
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, 'Missing config');
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = configGuard.safeParse(config);
|
const result = configGuard.safeParse(config);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -51,10 +51,7 @@ describe('validateConfig', () => {
|
||||||
).resolves.not.toThrow();
|
).resolves.not.toThrow();
|
||||||
});
|
});
|
||||||
it('should throw on empty config', async () => {
|
it('should throw on empty config', async () => {
|
||||||
// FIXME: @sijie
|
await expect(validateConfig({})).rejects.toThrowError();
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-expect-error
|
|
||||||
await expect(validateConfig()).rejects.toThrowError();
|
|
||||||
});
|
});
|
||||||
it('should throw when missing clientSecret', async () => {
|
it('should throw when missing clientSecret', async () => {
|
||||||
await expect(validateConfig({ clientId: 'clientId' })).rejects.toThrowError();
|
await expect(validateConfig({ clientId: 'clientId' })).rejects.toThrowError();
|
||||||
|
|
|
@ -37,10 +37,6 @@ const githubConfigGuard = z.object({
|
||||||
type GithubConfig = z.infer<typeof githubConfigGuard>;
|
type GithubConfig = z.infer<typeof githubConfigGuard>;
|
||||||
|
|
||||||
export const validateConfig: ValidateConfig = async (config: unknown) => {
|
export const validateConfig: ValidateConfig = async (config: unknown) => {
|
||||||
if (!config) {
|
|
||||||
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, 'Missing config');
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = githubConfigGuard.safeParse(config);
|
const result = githubConfigGuard.safeParse(config);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue