test: Add slight delay to media api in case it takes a while to write to log files

dev
Jonatan Nilsson 2021-10-11 01:32:29 +00:00
parent 4767bf11fe
commit 9823f80721
1 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,10 @@ t.describe('Media (API)', () => {
assert.match(err.message, /[Tt]oken/)
assert.match(err.message, /[Mm]issing/)
await new Promise(function(res) {
setTimeout(res, 10)
})
assert.strictEqual(server.log.error.callCount, 0)
assert.strictEqual(server.log.warn.callCount, 2)
assert.strictEqual(typeof(server.log.warn.firstCall[0]), 'string')
@ -63,6 +67,10 @@ t.describe('Media (API)', () => {
assert.strictEqual(err.status, 422)
assert.match(err.message, /[Tt]oken/)
assert.match(err.message, /[Ii]nvalid/)
await new Promise(function(res) {
setTimeout(res, 10)
})
assert.strictEqual(server.log.error.callCount, 1)
assert.strictEqual(server.log.warn.callCount, 2)