mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -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) => {
|
||||
if (!config) {
|
||||
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, 'Missing config');
|
||||
}
|
||||
|
||||
const result = configGuard.safeParse(config);
|
||||
|
||||
if (!result.success) {
|
||||
|
|
|
@ -51,10 +51,7 @@ describe('validateConfig', () => {
|
|||
).resolves.not.toThrow();
|
||||
});
|
||||
it('should throw on empty config', async () => {
|
||||
// FIXME: @sijie
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
await expect(validateConfig()).rejects.toThrowError();
|
||||
await expect(validateConfig({})).rejects.toThrowError();
|
||||
});
|
||||
it('should throw when missing clientSecret', async () => {
|
||||
await expect(validateConfig({ clientId: 'clientId' })).rejects.toThrowError();
|
||||
|
|
|
@ -37,10 +37,6 @@ const githubConfigGuard = z.object({
|
|||
type GithubConfig = z.infer<typeof githubConfigGuard>;
|
||||
|
||||
export const validateConfig: ValidateConfig = async (config: unknown) => {
|
||||
if (!config) {
|
||||
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, 'Missing config');
|
||||
}
|
||||
|
||||
const result = githubConfigGuard.safeParse(config);
|
||||
|
||||
if (!result.success) {
|
||||
|
|
Loading…
Add table
Reference in a new issue