Skip to content

Commit

Permalink
More robust logs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jul 31, 2023
1 parent 5e1ced7 commit 3229fcf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/tests/api/server/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('Test logs', function () {
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
expect(logsString.includes('Video with name video 1')).to.be.false
expect(logsString.includes('Video with name video 2')).to.be.true
})

it('Should get logs with an end date', async function () {
Expand All @@ -64,9 +64,9 @@ describe('Test logs', function () {
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
expect(logsString.includes('Video with name video 3')).to.be.false
expect(logsString.includes('Video with name video 4')).to.be.true
expect(logsString.includes('Video with name video 5')).to.be.false
})

it('Should filter by level', async function () {
Expand All @@ -81,14 +81,14 @@ describe('Test logs', function () {
const body = await logsCommand.getLogs({ startDate: now, level: 'info' })
const logsString = JSON.stringify(body)

expect(logsString.includes('video 6')).to.be.true
expect(logsString.includes('Video with name video 6')).to.be.true
}

{
const body = await logsCommand.getLogs({ startDate: now, level: 'warn' })
const logsString = JSON.stringify(body)

expect(logsString.includes('video 6')).to.be.false
expect(logsString.includes('Video with name video 6')).to.be.false
}
})

Expand Down

0 comments on commit 3229fcf

Please sign in to comment.