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

test: integration tests for validating connector configs (#1643)

Co-authored-by: Gao Sun <gao@silverhand.io>
This commit is contained in:
IceHe.life 2022-07-21 19:12:44 +08:00 committed by GitHub
parent d2389a6bb5
commit bdb2756617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import { ConnectorType } from '@logto/schemas';
import { HTTPError } from 'got';
import {
enableConnector,
@ -194,8 +195,19 @@ test('connector flow', async () => {
expect(enabledEmailConnector.length).toEqual(1);
expect(enabledEmailConnector[0]?.id).toEqual(sendgridEmailConnectorId);
/*
* It should update the connector config successfully when it is valid; otherwise, it should fail.
* We will test updating to the invalid connector config, that is the case not covered above.
*/
await expect(
updateConnectorConfig(aliyunEmailConnectorId, sendgridEmailConnectorConfig)
).rejects.toThrow(HTTPError);
// To confirm the failed updating request above did not modify the original config,
// we check: the Aliyun email connector config should stay the same.
const aliyunEmailConnector = await getConnector(aliyunEmailConnectorId);
expect(aliyunEmailConnector.config).toEqual(aliyunEmailConnectorConfig);
// Next up:
// - validate wrong connector config
// - delete (i.e. disable) connector
// - send sms/email test message
// - list all connectors after manually setting up connectors