Collapse the two id emptiness tests into one and pin the reassembler wording

This commit is contained in:
2026-08-27 16:42:26 +02:00
parent cf315737b7
commit 3c6195a938
3 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ exactly 140.
`esm_class` at 0, and reading that as the spec's "default message type" would lose every one of
them. A non-empty `receipted_message_id` TLV marks a receipt on the same footing there, since
nothing but a receipt carries one. What gets scraped is the decoded `short_message` with any UDH
stripped; receipts never reach the reassembler, so an SMSC that splits one across segments gets a
stripped; a receipt this library recognises never reaches the reassembler, so an SMSC that splits one across segments gets a
`dlr` per segment rather than one merged report.
The `message_state` TLV is authoritative only where it names a state in the table — SMPP reserves
0x80-0xFF for MC-vendor-specific values, so an unnameable one keeps its raw `statusId` and leaves
+1 -1
View File
@@ -160,7 +160,7 @@ function receiptBody(pduObj: PduObject): string {
}
function receiptId(tlvId: ParamValue | undefined, receipt: Receipt | undefined): string | undefined {
return nonEmptyText(tlvId) ?? (receipt?.id === '' ? undefined : receipt?.id);
return nonEmptyText(tlvId) ?? nonEmptyText(receipt?.id);
}
function isMessageState(name: string | undefined): name is MessageState {
+1 -3
View File
@@ -117,7 +117,7 @@ describe('dlrFromPdu()', () => {
assert.equal(dlrFromPdu(deliverSm('id:x stat:DELIVRD done date:2501012560'))?.doneDate, undefined);
});
test('returns nothing when an unmarked deliver_sm identifies no message', () => {
test('returns nothing when an unmarked deliver_sm yields no id or no status', () => {
assert.equal(dlrFromPdu(deliverSm('just a normal sms', undefined, 0)), undefined);
assert.equal(dlrFromPdu(deliverSm('id:0195f0c7 stat:WEIRDXX', undefined, 0)), undefined);
});
@@ -180,8 +180,6 @@ describe('dlrFromPdu()', () => {
assert.equal(empty, undefined, 'an empty id marks nothing');
});
// The spec names six of the sixteen message types and reserves the rest, so a peer that types
// its receipts with one of the reserved bits keeps the body scrape rather than losing them.
test('keeps the body scrape for a message type the spec reserves', () => {
const dlr = dlrFromPdu(deliverSm(receiptText, undefined, 0x0c));