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

This commit is contained in:
Jonatan Nilsson 2021-10-11 01:32:29 +00:00
parent 4767bf11fe
commit 9823f80721

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')
@ -64,6 +68,10 @@ t.describe('Media (API)', () => {
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)
assert.strictEqual(typeof(server.log.warn.firstCall[0]), 'string')