diff --git a/test/lib.test.mjs b/test/lib.test.mjs index 752bb32..b97a7d5 100644 --- a/test/lib.test.mjs +++ b/test/lib.test.mjs @@ -39,7 +39,23 @@ t.describe('', function() { 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], 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) })