From cffca53eb6c7ba56825c273f156d362d35b060b9 Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Sat, 2 Apr 2022 19:47:39 +0000 Subject: [PATCH] test: Fix tests that were relying on aborted log message. These are spammy and normal and shouldn't be logged --- test/flaska.api.test.mjs | 4 ++-- test/http.test.mjs | 17 +++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test/flaska.api.test.mjs b/test/flaska.api.test.mjs index c9b827d..e6af9a4 100644 --- a/test/flaska.api.test.mjs +++ b/test/flaska.api.test.mjs @@ -447,8 +447,8 @@ t.describe('_onreqerror', function() { let flaska = new Flaska({}, faker) let ctx = createCtx() flaska._onreqerror(assertError, ctx) - assert.strictEqual(ctx.log.info.callCount, 1) - assert.strictEqual(ctx.log.info.firstCall[0], assertError) + assert.strictEqual(ctx.log.info.callCount, 0) + assert.strictEqual(ctx.log.error.callCount, 0) }) }) diff --git a/test/http.test.mjs b/test/http.test.mjs index 3c9592e..d95e8ef 100644 --- a/test/http.test.mjs +++ b/test/http.test.mjs @@ -134,8 +134,8 @@ t.describe('/json', function() { await setTimeout(20) assert.strictEqual(log.error.callCount, 0) - assert.strictEqual(log.info.callCount, 1) - assert.strictEqual(log.info.firstCall[0].message, 'aborted') + assert.strictEqual(log.info.callCount, 0) + // assert.strictEqual(log.info.firstCall[0].message, 'aborted') }) }) @@ -145,14 +145,9 @@ t.describe('/timeout', function() { let err = await assert.isRejected(client.customRequest('GET', '/timeout', JSON.stringify({}), { timeout: 20 })) - while (!log.info.called) { - await setTimeout(10) - } - assert.match(err.message, /timed out/) assert.notOk(log.error.called) - assert.ok(log.info.called) - assert.strictEqual(log.info.firstCall[0].message, 'aborted') + assert.notOk(log.info.called) }) }) @@ -201,8 +196,7 @@ t.describe('/file', function() { } assert.strictEqual(log.error.callCount, 0) - assert.strictEqual(log.info.callCount, 1) - assert.strictEqual(log.info.firstCall[0].message, 'aborted') + assert.strictEqual(log.info.callCount, 0) assert.ok(file.closed) }) @@ -333,8 +327,7 @@ t.describe('HEAD', function() { } assert.strictEqual(log.error.callCount, 0) - assert.strictEqual(log.info.callCount, 1) - assert.strictEqual(log.info.firstCall[0].message, 'aborted') + assert.strictEqual(log.info.callCount, 0) assert.ok(file.closed) })