mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
test: integration tests for deleting connectors (#1648)
This commit is contained in:
parent
bdb2756617
commit
7f06dfa575
2 changed files with 19 additions and 2 deletions
|
@ -16,9 +16,15 @@ export const updateConnectorConfig = async (connectorId: string, config: Record<
|
|||
.json<ConnectorDto>();
|
||||
|
||||
export const enableConnector = async (connectorId: string) =>
|
||||
updateConnectorEnabledProperty(connectorId, true);
|
||||
|
||||
export const disableConnector = async (connectorId: string) =>
|
||||
updateConnectorEnabledProperty(connectorId, false);
|
||||
|
||||
const updateConnectorEnabledProperty = (connectorId: string, enabled: boolean) =>
|
||||
authedAdminApi
|
||||
.patch({
|
||||
url: `connectors/${connectorId}/enabled`,
|
||||
json: { enabled: true },
|
||||
json: { enabled },
|
||||
})
|
||||
.json<ConnectorDto>();
|
||||
|
|
|
@ -2,6 +2,7 @@ import { ConnectorType } from '@logto/schemas';
|
|||
import { HTTPError } from 'got';
|
||||
|
||||
import {
|
||||
disableConnector,
|
||||
enableConnector,
|
||||
getConnector,
|
||||
listConnectors,
|
||||
|
@ -207,8 +208,18 @@ test('connector flow', async () => {
|
|||
const aliyunEmailConnector = await getConnector(aliyunEmailConnectorId);
|
||||
expect(aliyunEmailConnector.config).toEqual(aliyunEmailConnectorConfig);
|
||||
|
||||
/*
|
||||
* Delete (i.e. disable) a connector
|
||||
*
|
||||
* We have not provided the API to delete a connector for now.
|
||||
* Deleting a connector using Admin Console means disabling a connector using Management API.
|
||||
*/
|
||||
const disabledSendgridEmailConnector = await disableConnector(sendgridEmailConnectorId);
|
||||
expect(disabledSendgridEmailConnector.enabled).toBeFalsy();
|
||||
const sendgridEmailConnector = await getConnector(sendgridEmailConnectorId);
|
||||
expect(sendgridEmailConnector.enabled).toBeFalsy();
|
||||
|
||||
// Next up:
|
||||
// - delete (i.e. disable) connector
|
||||
// - send sms/email test message
|
||||
// - list all connectors after manually setting up connectors
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue