0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

refactor(core): remove unused getEnabledSocialConnectorIds (#1585)

This commit is contained in:
IceHe.xyz 2022-07-18 18:28:10 +08:00 committed by GitHub
parent 40ae99b030
commit 0ed9452cc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 26 deletions

View file

@ -4,7 +4,6 @@ import { Connector } from '@logto/schemas';
import {
getConnectorInstanceById,
getConnectorInstances,
getEnabledSocialConnectorIds,
getSocialConnectorInstanceById,
initConnectors,
} from '@/connectors/index';
@ -188,17 +187,6 @@ describe('getSocialConnectorInstanceById', () => {
});
});
describe('getEnabledSocialConnectorIds', () => {
test('should return the enabled social connectors existing in DB', async () => {
const enabledSocialConnectorIds = await getEnabledSocialConnectorIds();
expect(enabledSocialConnectorIds).toEqual([
'alipay-web',
'facebook-universal',
'github-universal',
]);
});
});
describe('initConnectors', () => {
test('should insert the necessary connector if it does not exist in DB', async () => {
findAllConnectors.mockImplementationOnce(async () => []);

View file

@ -140,19 +140,6 @@ export const getSocialConnectorInstanceById = async (
return connector;
};
export const getEnabledSocialConnectorIds = async <T extends ConnectorInstance>(): Promise<
string[]
> => {
const connectorInstances = await getConnectorInstances();
return connectorInstances
.filter<T>(
(instance): instance is T =>
instance.connector.enabled && instance.metadata.type === ConnectorType.Social
)
.map((instance) => instance.connector.id);
};
export const initConnectors = async () => {
const connectors = await findAllConnectors();
const existingConnectors = new Map(connectors.map((connector) => [connector.id, connector]));

View file

@ -32,7 +32,6 @@ const getConnectorInstances = jest.fn(async () => connectorInstances);
jest.mock('@/connectors', () => {
return {
...jest.requireActual('@/connectors'),
getEnabledSocialConnectorIds: jest.fn(async () => ['facebook', 'github', 'wechat']),
getConnectorInstances: jest.fn(async () => getConnectorInstances()),
};
});