Fix views tests
This commit is contained in:
parent
200e9dbd3c
commit
d16d2e6744
|
@ -134,19 +134,22 @@ describe('Test live socket messages', function () {
|
|||
expect(localLastVideoViews).to.equal(0)
|
||||
expect(remoteLastVideoViews).to.equal(0)
|
||||
|
||||
await servers[0].views.simulateView({ id: liveVideoUUID })
|
||||
await servers[1].views.simulateView({ id: liveVideoUUID })
|
||||
|
||||
await wait(3000)
|
||||
|
||||
await servers[0].views.simulateView({ id: liveVideoUUID })
|
||||
await servers[1].views.simulateView({ id: liveVideoUUID })
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
await servers[0].views.simulateView({ id: liveVideoUUID, sessionId: 'session1' })
|
||||
await servers[1].views.simulateView({ id: liveVideoUUID, sessionId: 'session2' })
|
||||
} catch (err) {
|
||||
console.error('Cannot simulate view', err)
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
await wait(6000)
|
||||
await waitJobs(servers)
|
||||
|
||||
expect(localLastVideoViews).to.equal(2)
|
||||
expect(remoteLastVideoViews).to.equal(2)
|
||||
|
||||
clearInterval(interval)
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
})
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ export const videoViewValidator = [
|
|||
.customSanitizer(toIntOrNull)
|
||||
.isInt(),
|
||||
|
||||
body('sessionId')
|
||||
.optional()
|
||||
.isAlphanumeric(),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
if (areValidationErrors(req, res, { tags })) return
|
||||
if (!await doesVideoExist(req.params.videoId, res, 'unsafe-only-immutable-attributes')) return
|
||||
|
|
Loading…
Reference in New Issue