Read and write every copy of a TLV SMPP lets repeat, and drop the dormant tlvMap
Test / lint (pull_request) Successful in 21s
Test / test (18) (pull_request) Successful in 28s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 29s
Test / test (24) (pull_request) Successful in 30s
Test / test (26) (pull_request) Successful in 29s
Mirror / push (push) Successful in 6s

This commit is contained in:
2026-09-24 00:37:10 +02:00
parent c5ef4c4703
commit 224acca7d0
12 changed files with 120 additions and 52 deletions
+25
View File
@@ -420,6 +420,31 @@ describe('TLVs', () => {
assert.deepEqual(rebuilt.tlvs.message_payload?.tagValue, payload);
});
test('reads every copy of a tag SMPP lets repeat, in wire order, and writes them back', () => {
const numbers = [Buffer.from('46701113311', 'latin1'), Buffer.from('46709771337', 'latin1')];
const pduObj = decode(encode({
cmdName: 'submit_sm',
params: { destination_addr: '46709771337', short_message: 'hi', source_addr: '46701113311' },
tlvs: { callback_num: { tagValue: numbers }, callback_num_pres_ind: { tagValue: [1] } },
}));
assert.deepEqual(pduObj.tlvs.callback_num, { tagId: 0x0381, tagName: 'callback_num', tagValue: numbers });
assert.deepEqual(pduObj.tlvs.callback_num_pres_ind?.tagValue, [1]);
});
test('refuses a single value for a tag SMPP lets repeat, and a list for one it does not', () => {
const params = { destination_addr: '46709771337', short_message: 'hi', source_addr: '46701113311' };
const single = objToPdu({
cmdName: 'submit_sm',
params,
tlvs: { callback_num: { tagValue: Buffer.from('46701113311', 'latin1') } },
});
const list = objToPdu({ cmdName: 'submit_sm', params, tlvs: { source_port: { tagValue: [1234] } } });
assert.match(single.err?.message ?? '', /TLV "callback_num": .*list/);
assert.match(list.err?.message ?? '', /TLV "source_port": .*list/);
});
test('takes the tag id from the record key when the caller gives none', () => {
const pduObj = decode(encode({
cmdName: 'deliver_sm',