fix: refresh pending report detail summary

This commit is contained in:
hectorzhao
2026-09-03 12:33:57 +08:00
parent b0016cfd8d
commit 55915ed826
5 changed files with 54 additions and 34 deletions
+10 -3
View File
@@ -1231,7 +1231,14 @@ describe('SmsConfigService', () => {
expect(result.items[0]).not.toHaveProperty('drainageReportTargets');
});
it('returns the filtered total of signature channel-carrier details still awaiting batch generation', async () => {
it.each([
['abandoned', 1],
['pending', 2],
['reporting', 2],
['approved', 2],
['failed', 2],
['rejected', 2],
])('keeps the pending detail total aligned after a persisted %s task status', async (taskStatus, expectedTotal) => {
const prisma = createPrismaMock();
prisma.smsSignature.findMany.mockImplementation(({ where }) => {
if (where?.AND) {
@@ -1242,7 +1249,7 @@ describe('SmsConfigService', () => {
materialVersion: 2,
application: { status: 'active' },
reportTasks: [
{ channelId: 'channel-1', carrier: 'mobile', status: 'abandoned', approvalScope: 'carrier_specific' },
{ channelId: 'channel-1', carrier: 'mobile', status: taskStatus, approvalScope: 'carrier_specific' },
],
reportBatchItems: [],
},
@@ -1273,7 +1280,7 @@ describe('SmsConfigService', () => {
const result = await service.listSignaturesPage({ signatureKeyword: '测试', page: 1, pageSize: 10 });
expect(result.pendingReportDetailTotal).toBe(1);
expect(result.pendingReportDetailTotal).toBe(expectedTotal);
expect(prisma.smsSignature.findMany).toHaveBeenCalledWith(
expect.objectContaining({
where: { AND: [expect.objectContaining({ name: { contains: '测试' } }), { auditStatus: 'approved', pendingReport: true }] },