Fixtures for the receipt bodies operator documentation publishes (#93)

* Fixtures for the receipt bodies operator documentation publishes

* Read the stat:FAILED several operators write as UNDELIVERABLE

* Cover the 16-bit UDH concatenation element with a fixture

* Record phase 9 of the interoperability plan

* Share the dummy SMSC and tighten the operator fixtures

* Correct what the test conventions claim about the doubles and the tree

* Read a receipt date that carries its century

* Read the stat spelling CM.com publishes

* Say what the receipt status table actually holds
This commit is contained in:
2026-09-08 18:56:57 +02:00
committed by GitHub
parent 83176f53b0
commit 5a0cf56754
11 changed files with 946 additions and 58 deletions
+31 -2
View File
@@ -1471,8 +1471,10 @@ describe('sendDlr()', () => {
});
});
function segment(reference: number, part: number, total: number): PduObject {
const udh = Buffer.from([0x05, 0x00, 0x03, reference, total, part]);
function segment(reference: number, part: number, total: number, width: 8 | 16 = 8): PduObject {
const udh = width === 8
? Buffer.from([0x05, 0x00, 0x03, reference, total, part])
: Buffer.from([0x06, 0x08, 0x04, reference >>> 8, reference & 0xff, total, part]);
const body = Buffer.concat([udh, Buffer.from('fragment')]);
return {
@@ -1544,6 +1546,11 @@ describe('where a segment says it is concatenated', () => {
test('names the spelling a segment was numbered by, alongside the reference', () => {
assert.deepEqual(concatOf(sarSegment(5, 2, 3)), { part: 2, reference: 5, spelling: 'sar', total: 3 });
assert.deepEqual(concatOf(segment(5, 2, 3)), { part: 2, reference: 5, spelling: 'udh', total: 3 });
assert.deepEqual(
concatOf(segment(0x2af1, 2, 3, 16)),
{ part: 2, reference: 0x2af1, spelling: 'udh', total: 3 },
'GSM 03.40 element 0x08 numbers a segment as element 0x00 does, two octets wider',
);
});
test('reads a segment carrying both spellings from its UDH', () => {
@@ -1632,6 +1639,28 @@ describe('reassembly bounds', () => {
assert.equal(third.smsId, collected.smsId);
});
// The header is stripped by its own declared length, so the wider element assembles identically.
test('assembles a message numbered by a 16-bit UDH reference', () => {
const reassembler = new Reassembler({
log: silentLog,
max: 10,
now: () => 0,
onLost: () => undefined,
timeout: 60_000,
});
const first = collectPdu(reassembler, segment(0x2af1, 1, 2, 16));
assert.ok(first.kept);
assert.equal(first.whole, undefined);
const collected = collectPdu(reassembler, segment(0x2af1, 2, 2, 16));
assert.ok(collected.kept);
assert.ok(collected.whole);
assert.equal(decodeSegments(collected.whole), 'fragmentfragment');
});
// A group the store cannot hold at all is refused, not accepted and then thrown away.
test('refuses a lone segment whose own arrival overruns the octet cap', () => {
const lost: LostGroup[] = [];