fix: close documented platform polish gaps
This commit is contained in:
@@ -279,7 +279,7 @@ describe('ChannelsService', () => {
|
||||
};
|
||||
|
||||
await expect(service.createChannel({ ...channel, rateLimitPerSecond: 2001 })).rejects.toThrow('rateLimitPerSecond must be between 1 and 2000');
|
||||
await expect(service.createChannel({ ...channel, config: { extensionDigits: 3 } })).rejects.toThrow('extensionDigits must be one of 0, 2, 4, or 6');
|
||||
await expect(service.createChannel({ ...channel, config: { extensionDigits: 21 } })).rejects.toThrow('extensionDigits must be an integer between 0 and 20');
|
||||
});
|
||||
|
||||
it('updates CMPP channel configuration without requiring password changes', async () => {
|
||||
@@ -326,6 +326,17 @@ describe('ChannelsService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('persists an arbitrary integer extension digit count within the supported range', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new ChannelsService(prisma as never);
|
||||
|
||||
await service.updateChannel('channel-1', { config: { extensionDigits: 15 } });
|
||||
|
||||
expect(prisma.smsChannel.update).toHaveBeenCalledWith(expect.objectContaining({
|
||||
data: expect.objectContaining({ config: expect.objectContaining({ extensionDigits: 15 }) }),
|
||||
}));
|
||||
});
|
||||
|
||||
it('rejects invalid channel update ports', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new ChannelsService(prisma as never);
|
||||
|
||||
@@ -1417,8 +1417,8 @@ function normalizeExtensionDigits(value: unknown) {
|
||||
return 0;
|
||||
}
|
||||
const normalized = Number(value);
|
||||
if (![0, 2, 4, 6].includes(normalized)) {
|
||||
throw new BadRequestException('extensionDigits must be one of 0, 2, 4, or 6');
|
||||
if (!Number.isInteger(normalized) || normalized < 0 || normalized > 20) {
|
||||
throw new BadRequestException('extensionDigits must be an integer between 0 and 20');
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user