From 4031cfadf145cf59af71bc8f630d864fc48cb898 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 28 Sep 2026 00:52:39 +0200 Subject: [PATCH] Stub the handlers an Sms answers and receipts through --- test/session-extras.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/session-extras.test.ts b/test/session-extras.test.ts index 25283b1..8e23ed3 100644 --- a/test/session-extras.test.ts +++ b/test/session-extras.test.ts @@ -102,6 +102,7 @@ function abortAfter( function stubPort(session: Session, port: Partial = {}): IncomingDeps { return { + acceptsOptionalParams: () => true, answer: (pduObj, status, params) => session.sendReturn(pduObj, status, params), bindAllows: () => true, boundAs: () => 'transceiver', @@ -1653,11 +1654,9 @@ describe('held message bounds', () => { describe('sendResp()', () => { // A response the wire never carried leaves the peer owed one, so nothing may count it answered. test('does not count a response that never reached the wire as an answer', async t => { - const sock = new net.Socket(); - const session = new Session({ sock }); + const session = new Session({ sock: new net.Socket() }); closeAfter(t, session); - sock.destroy(); let answered = 0; const sms = createSms({ @@ -1667,6 +1666,9 @@ describe('sendResp()', () => { session, to: '46709771337', }, { + acceptsOptionalParams: () => true, + answer: () => Promise.resolve({ err: new Error('Socket is closed') }), + bindAllows: () => true, lostLink: () => false, onAnswered: () => { answered++; }, send: () => Promise.resolve({ err: new Error('never sent') }), @@ -1692,6 +1694,9 @@ describe('sendDlr()', () => { session, to: '46709771337', }, { + acceptsOptionalParams: () => true, + answer: () => Promise.resolve({}), + bindAllows: () => true, lostLink: () => false, onAnswered: () => undefined, send: () => {