fix: close admin channel test sms loop

This commit is contained in:
hectorzhao
2026-07-09 11:49:20 +08:00
parent a4a638208e
commit c58a010951
12 changed files with 582 additions and 17 deletions
@@ -554,6 +554,36 @@ describe('SendChainService', () => {
});
});
it('updates admin channel test message status without business retry routing', async () => {
const { service, prisma, billing } = createService();
prisma.smsBatchTask.findUnique.mockResolvedValue({ id: 'task-1', tenantId: 'tenant-1', sourceType: 'admin_channel_test' });
await service.handleSubmitResult({
messageId: 'MSG-1',
channelId: 'channel-1',
submitId: 'SUB-1',
sequenceId: 7,
gatewayMessageId: 'GW-1',
submitStatus: 'timeout',
errorCode: 'SUBMIT_TIMEOUT',
errorMessage: 'context deadline exceeded',
submittedAt: '2026-07-09T03:44:15.445Z',
});
expect(prisma.channelRouteRule.findFirst).not.toHaveBeenCalled();
expect(billing.release).not.toHaveBeenCalled();
expect(prisma.smsMessageRecord.update).toHaveBeenCalledWith({
where: { id: 'record-1' },
data: expect.objectContaining({
gatewayMessageId: 'GW-1',
submitStatus: 'timeout',
status: 'timeout',
errorCode: 'SUBMIT_TIMEOUT',
errorMessage: 'context deadline exceeded',
}),
});
});
it('releases reservation for rejected submit result and refunds failed receipts', async () => {
const { service, prisma, billing } = createService();
prisma.smsBillingRecord.findFirst