digitalinteraction / deconf-api-toolkit

A library for running decentralised virtual conferences
https://deconf-api.openlab.dev/
MIT License
2 stars 0 forks source link

Fix MetricsSockets' release lock test #11

Open robb-j opened 2 years ago

robb-j commented 2 years ago

It stopped working because because cameOnline no longer awaits #triggerVisitors.

it('should release the lock', async () => {
  const { metrics, semaphore, sockets } = setup()
  mocked(sockets.getSocketsInRoom).mockResolvedValue([
    'socket-a',
    'socket-b',
    'socket-c',
  ])
  mocked(semaphore.aquire).mockResolvedValue(true)
  mocked(semaphore.hasLock).mockResolvedValue(true)

  await metrics.cameOnline('socket-a')

  expect(semaphore.release).toBeCalledWith('site_visitors')
})