0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(test): integration tests for list connectors after manually setting up connectors (#1658)

This commit is contained in:
IceHe.life 2022-07-23 13:04:39 +08:00 committed by GitHub
parent 55a6c4248c
commit 3773701fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -223,41 +223,34 @@ test('connector flow', async () => {
* List connectors after manually setting up connectors. * List connectors after manually setting up connectors.
* The result of listing connectors should be same as the result of updating connectors above. * The result of listing connectors should be same as the result of updating connectors above.
*/ */
const allConnectorsAfterSettingUp = await listConnectors(); expect(await listConnectors()).toEqual(
expect.arrayContaining([
const facebookConnectorFromList = allConnectorsAfterSettingUp.find( expect.objectContaining({
(connector) => connector.id === facebookConnectorId id: facebookConnectorId,
); config: facebookConnectorConfig,
expect(facebookConnectorFromList).toMatchObject( enabled: true,
expect.objectContaining({ enabled: true, config: facebookConnectorConfig }) }),
); expect.objectContaining({
id: aliyunSmsConnectorId,
const aliyunSmsConnectorFromList = allConnectorsAfterSettingUp.find( config: aliyunSmsConnectorConfig,
(connector) => connector.id === aliyunSmsConnectorId enabled: false,
); }),
expect(aliyunSmsConnectorFromList).toMatchObject( expect.objectContaining({
expect.objectContaining({ enabled: false, config: aliyunSmsConnectorConfig }) id: twilioSmsConnectorId,
); config: twilioSmsConnectorConfig,
enabled: true,
const twilioSmsConnectorFromList = allConnectorsAfterSettingUp.find( }),
(connector) => connector.id === twilioSmsConnectorId expect.objectContaining({
); id: aliyunEmailConnectorId,
expect(twilioSmsConnectorFromList).toMatchObject( config: aliyunEmailConnectorConfig,
expect.objectContaining({ enabled: true, config: twilioSmsConnectorConfig }) enabled: false,
); }),
expect.objectContaining({
const aliyunEmailConnectorFromList = allConnectorsAfterSettingUp.find( id: sendgridEmailConnectorId,
(connector) => connector.id === aliyunEmailConnectorId config: sendgridEmailConnectorConfig,
); enabled: false,
expect(aliyunEmailConnectorFromList).toMatchObject( }),
expect.objectContaining({ enabled: false, config: aliyunEmailConnectorConfig }) ])
);
const sendgridEmailConnectorFromList = allConnectorsAfterSettingUp.find(
(connector) => connector.id === sendgridEmailConnectorId
);
expect(sendgridEmailConnectorFromList).toMatchObject(
expect.objectContaining({ enabled: false, config: sendgridEmailConnectorConfig })
); );
// Next up // Next up