From 9823f80721eb8d214f19239f8fd49c54126012ca Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Mon, 11 Oct 2021 01:32:29 +0000 Subject: [PATCH] test: Add slight delay to media api in case it takes a while to write to log files --- test/media/api.test.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/media/api.test.mjs b/test/media/api.test.mjs index 0d6f901..ef94aba 100644 --- a/test/media/api.test.mjs +++ b/test/media/api.test.mjs @@ -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)