+ const body = await logsCommand.getLogs({ startDate: now })
+ const logsString = JSON.stringify(body)
+
+ expect(logsString.includes('video 1')).to.be.false
+ expect(logsString.includes('video 2')).to.be.true
+ })
+
+ it('Should get logs with an end date', async function () {
+ this.timeout(30000)
+
+ await server.videos.upload({ attributes: { name: 'video 3' } })
+ await waitJobs([ server ])
+
+ const now1 = new Date()
+
+ await server.videos.upload({ attributes: { name: 'video 4' } })
+ await waitJobs([ server ])
+
+ const now2 = new Date()
+
+ await server.videos.upload({ attributes: { name: 'video 5' } })
+ await waitJobs([ server ])
+
+ const body = await logsCommand.getLogs({ startDate: now1, endDate: now2 })
+ const logsString = JSON.stringify(body)
+
+ expect(logsString.includes('video 3')).to.be.false
+ expect(logsString.includes('video 4')).to.be.true
+ expect(logsString.includes('video 5')).to.be.false
+ })
+
+ it('Should filter by level', async function () {
+ this.timeout(20000)
+
+ const now = new Date()
+
+ await server.videos.upload({ attributes: { name: 'video 6' } })
+ await waitJobs([ server ])
+
+ {
+ const body = await logsCommand.getLogs({ startDate: now, level: 'info' })
+ const logsString = JSON.stringify(body)
+
+ expect(logsString.includes('video 6')).to.be.true
+ }
+
+ {
+ const body = await logsCommand.getLogs({ startDate: now, level: 'warn' })
+ const logsString = JSON.stringify(body)