Test that the session owns its bind state and keeps it through a reconnect's gap

This commit is contained in:
2026-09-28 03:55:40 +02:00
parent b0b7404477
commit ebc5db5a00
4 changed files with 33 additions and 5 deletions
+23 -1
View File
@@ -229,7 +229,7 @@ describe('bind', () => {
assert.equal(err, undefined);
assert.ok(session);
assert.ok(session.loggedIn);
assert.equal(session.boundAs, 'transceiver');
assert.deepEqual(await session.unbind(), {});
});
@@ -448,6 +448,28 @@ describe('bind', () => {
assert.ok(session.acceptsOptionalParams());
});
test('records a hand-wired bind through bound(), and nothing else writes it', t => {
const session = new Session({ sock: new net.Socket() });
closeAfter(t, session);
assert.equal(session.boundAs, undefined);
assert.equal(session.peerInterfaceVersion, undefined);
session.bound('receiver', 0x34);
assert.equal(session.boundAs, 'receiver');
assert.equal(session.peerInterfaceVersion, 0x34);
assert.equal(session.bindAllows('submit_sm'), false);
session.bound('transmitter', undefined);
assert.equal(session.peerInterfaceVersion, 0x00, 'no declared version is pre-3.4');
assert.equal(Reflect.set(session, 'boundAs', 'transceiver'), false);
assert.equal(Reflect.set(session, 'peerInterfaceVersion', 0x50), false);
assert.equal(session.boundAs, 'transmitter');
assert.equal('loggedIn' in session, false);
});
// The spec: an absent sc_interface_version means the SMSC supports no optional parameters.
test('takes an SMSC that declares no version as older than 3.4', async t => {
const peer = await smscPeer(t);