Refuse an empty list for a repeatable TLV
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 19s
Test / test (18) (pull_request) Successful in 30s
Test / test (20) (pull_request) Successful in 28s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 28s
Test / test (26) (pull_request) Successful in 30s

This commit is contained in:
2026-09-24 00:42:03 +02:00
parent 224acca7d0
commit 9c83dd1d99
3 changed files with 10 additions and 3 deletions
+3 -1
View File
@@ -432,16 +432,18 @@ describe('TLVs', () => {
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', () => {
test('refuses a single value or an empty list 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 empty = objToPdu({ cmdName: 'submit_sm', params, tlvs: { callback_num: { tagValue: [] } } });
const list = objToPdu({ cmdName: 'submit_sm', params, tlvs: { source_port: { tagValue: [1234] } } });
assert.match(single.err?.message ?? '', /TLV "callback_num": .*list/);
assert.match(empty.err?.message ?? '', /TLV "callback_num": .*leave the tag out/);
assert.match(list.err?.message ?? '', /TLV "source_port": .*list/);
});