From 874c50b4858c2b72aab3998189a384449431920a Mon Sep 17 00:00:00 2001 From: Wiktor Date: Mon, 18 Sep 2023 16:36:53 +0200 Subject: [PATCH] Add test for unsuspendable events presence --- .../src/nest/socket/socket.service.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/backend/src/nest/socket/socket.service.spec.ts b/packages/backend/src/nest/socket/socket.service.spec.ts index d2c3948cec..8afab44c23 100644 --- a/packages/backend/src/nest/socket/socket.service.spec.ts +++ b/packages/backend/src/nest/socket/socket.service.spec.ts @@ -5,6 +5,7 @@ import { SocketModule } from './socket.module' import { SocketService } from './socket.service' import { io, Socket } from 'socket.io-client' import waitForExpect from 'wait-for-expect' +import { SocketActionTypes } from '@quiet/types' import { suspendableSocketEvents } from './suspendable.events' import { TEST_DATA_PORT } from '../const' @@ -52,4 +53,22 @@ describe('SocketService', () => { expect(spy).toHaveBeenCalledWith(event, undefined) }) }) + + it('there are no fragile endpoints in the collection of suspendables', async () => { + const fragile: string[] = [ + SocketActionTypes.CREATE_NETWORK.valueOf(), + SocketActionTypes.CREATE_COMMUNITY.valueOf(), + SocketActionTypes.LAUNCH_COMMUNITY.valueOf(), + SocketActionTypes.LAUNCH_REGISTRAR.valueOf(), + SocketActionTypes.REGISTER_OWNER_CERTIFICATE.valueOf(), + SocketActionTypes.REGISTER_USER_CERTIFICATE.valueOf(), + SocketActionTypes.SAVE_OWNER_CERTIFICATE.valueOf(), + SocketActionTypes.SAVE_USER_CSR.valueOf(), + SocketActionTypes.SEND_COMMUNITY_METADATA.valueOf(), + ] + + fragile.forEach(event => { + expect(suspendableSocketEvents).not.toContain(event) + }) + }) })