lib: Fix test for the new port parameter support

This commit is contained in:
Jonatan Nilsson 2022-03-10 13:40:10 +00:00
parent 1d7b118229
commit 4a508d20a4

View file

@ -39,7 +39,23 @@ t.describe('', function() {
let err = await assert.isRejected(core.run()) let err = await assert.isRejected(core.run())
assert.strictEqual(err, assertError) assert.strictEqual(err, assertError)
assert.strictEqual(module.start.firstCall[0], core.app.http) assert.strictEqual(module.start.firstCall[0], core.app.http)
assert.strictEqual(module.start.firstCall[1], null) assert.strictEqual(module.start.firstCall[1], 4000)
assert.strictEqual(module.start.firstCall[2], core.app.ctx)
})
t.test('should support overwriting port', async function() {
const assertError = new Error('Inbo')
const assertPort = 9382
module.start.rejects(assertError)
let core = new sc.ServiceCore('testapp', import.meta.url, assertPort)
await core.init(module)
let err = await assert.isRejected(core.run())
assert.strictEqual(err, assertError)
assert.strictEqual(module.start.firstCall[0], core.app.http)
assert.strictEqual(module.start.firstCall[1], assertPort)
assert.strictEqual(module.start.firstCall[2], core.app.ctx) assert.strictEqual(module.start.firstCall[2], core.app.ctx)
}) })