Skip to content

Commit

Permalink
Add test for unsuspendable events presence
Browse files Browse the repository at this point in the history
  • Loading branch information
siepra committed Sep 18, 2023
1 parent b7b5a10 commit 874c50b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/backend/src/nest/socket/socket.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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)
})
})
})

0 comments on commit 874c50b

Please sign in to comment.