test: Fix tests that were relying on aborted log message. These are spammy and normal and shouldn't be logged
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded

This commit is contained in:
Jonatan Nilsson 2022-04-02 19:47:39 +00:00
parent 3a454d44ce
commit cffca53eb6
2 changed files with 7 additions and 14 deletions

View file

@ -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)
})
})

View file

@ -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)
})