Name the refusal rule, and refuse a period the encoder cannot spell (#99)
* Refuse a relative validity period the SMPP time format cannot hold * Export unencodableText(), so a caller can word a refusal as the library does * Name the refusal rule in the README, and correct what it claims * Word the period refusal by what the encoder spells, and keep unencodableText() internal * Correct the decision bullet premise about what the relative format holds * Close the stability nits on the time guard and its tests
This commit is contained in:
@@ -382,6 +382,17 @@ describe('a time no peer can read', () => {
|
||||
assert.equal(attempts.length, 0);
|
||||
});
|
||||
|
||||
test('refuses a year-long relative period rather than sending 99 days and reporting a year', async () => {
|
||||
const attempts: PduObjectInput[] = [];
|
||||
const sent = await submitSms(recordingDeps(attempts), { from, message: 'Hello world', to, validityPeriod: 86400 * 365 });
|
||||
|
||||
assert.ok(sent.err instanceof Error);
|
||||
assert.match(sent.err.message, /validityPeriod/);
|
||||
assert.match(sent.err.message, /Date/);
|
||||
assert.deepEqual(sent.smsIds, []);
|
||||
assert.equal(attempts.length, 0, 'a period the relative format cannot hold puts nothing on the wire');
|
||||
});
|
||||
|
||||
test('refuses a time that is no kind of time rather than throwing out of the send', async () => {
|
||||
const attempts: PduObjectInput[] = [];
|
||||
const deps = recordingDeps(attempts);
|
||||
|
||||
Reference in New Issue
Block a user