test: Add slight delay to media api in case it takes a while to write to log files
This commit is contained in:
parent
4767bf11fe
commit
9823f80721
1 changed files with 8 additions and 0 deletions
|
@ -40,6 +40,10 @@ t.describe('Media (API)', () => {
|
||||||
assert.match(err.message, /[Tt]oken/)
|
assert.match(err.message, /[Tt]oken/)
|
||||||
assert.match(err.message, /[Mm]issing/)
|
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.error.callCount, 0)
|
||||||
assert.strictEqual(server.log.warn.callCount, 2)
|
assert.strictEqual(server.log.warn.callCount, 2)
|
||||||
assert.strictEqual(typeof(server.log.warn.firstCall[0]), 'string')
|
assert.strictEqual(typeof(server.log.warn.firstCall[0]), 'string')
|
||||||
|
@ -63,6 +67,10 @@ t.describe('Media (API)', () => {
|
||||||
assert.strictEqual(err.status, 422)
|
assert.strictEqual(err.status, 422)
|
||||||
assert.match(err.message, /[Tt]oken/)
|
assert.match(err.message, /[Tt]oken/)
|
||||||
assert.match(err.message, /[Ii]nvalid/)
|
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.error.callCount, 1)
|
||||||
assert.strictEqual(server.log.warn.callCount, 2)
|
assert.strictEqual(server.log.warn.callCount, 2)
|
||||||
|
|
Loading…
Reference in a new issue