fix: decouple channel test sms records

This commit is contained in:
hectorzhao
2026-07-09 12:23:43 +08:00
parent c58a010951
commit e0579857c6
13 changed files with 190 additions and 135 deletions
+4 -13
View File
@@ -596,20 +596,12 @@ describe('ChannelsService', () => {
channelId: 'channel-1',
status: 'submit_queued',
submitted: 1,
batchTaskId: 'batch-1',
testNo: expect.stringMatching(/^CHTEST-/),
}));
expect(prisma.smsBatchTask.create).toHaveBeenCalledWith({
data: expect.objectContaining({
tenantId: 'tenant-1',
sourceType: 'admin_channel_test',
phoneTotal: 1,
status: 'submit_queued',
}),
});
expect(prisma.tenant.findFirst).not.toHaveBeenCalled();
expect(prisma.smsBatchTask.create).not.toHaveBeenCalled();
expect(prisma.smsMessageRecord.create).toHaveBeenCalledWith({
data: expect.objectContaining({
tenantId: 'tenant-1',
batchTaskId: 'batch-1',
phoneNumber: '18821203795',
channelId: 'channel-1',
status: 'submit_queued',
@@ -618,8 +610,6 @@ describe('ChannelsService', () => {
});
expect(prisma.smsSubmitRecord.create).toHaveBeenCalledWith({
data: expect.objectContaining({
tenantId: 'tenant-1',
batchTaskId: 'batch-1',
channelId: 'channel-1',
sessionId: 'session-1',
submitStatus: 'queued',
@@ -645,6 +635,7 @@ describe('ChannelsService', () => {
action: 'sms_channel.test_submit',
resource: 'sms_channel',
resourceId: 'channel-1',
detail: expect.objectContaining({ testNo: expect.stringMatching(/^CHTEST-/) }),
}),
});
});