feat: add channel report batch briefs
This commit is contained in:
@@ -781,7 +781,7 @@ describe('SmsConfigService', () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new SmsConfigService(prisma as never);
|
||||
|
||||
await expect(service.listSignatures({ enterpriseKeyword: '租户', applicationKeyword: '应用', signatureKeyword: '签名', drainageKeyword: '官网', signatureSort: 'asc' })).resolves.toEqual([
|
||||
await expect(service.listSignatures({ enterpriseKeyword: '租户', applicationKeyword: '应用', signatureKeyword: '签名', drainageKeyword: '官网' })).resolves.toEqual([
|
||||
expect.objectContaining({
|
||||
id: 'sig-1',
|
||||
tenant: expect.objectContaining({ name: '租户A' }),
|
||||
@@ -804,7 +804,7 @@ describe('SmsConfigService', () => {
|
||||
reportTasks: expect.objectContaining({ select: expect.any(Object) }),
|
||||
reportBatchItems: expect.any(Object),
|
||||
}),
|
||||
orderBy: [{ name: 'asc' }, { id: 'asc' }],
|
||||
orderBy: { createdAt: 'desc' },
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -1223,6 +1223,7 @@ describe('SmsConfigService', () => {
|
||||
const result = await service.listSignaturesPage({ page: 1, pageSize: 10 });
|
||||
|
||||
expect(result.total).toBe(1);
|
||||
expect(result.pendingReportDetailTotal).toBe(0);
|
||||
expect(result.items[0]).toEqual(expect.objectContaining({ id: 'sig-1', name: '【签名A】' }));
|
||||
expect(result.items[0]).not.toHaveProperty('materials');
|
||||
expect(result.items[0]).not.toHaveProperty('reportTasks');
|
||||
@@ -1230,6 +1231,56 @@ describe('SmsConfigService', () => {
|
||||
expect(result.items[0]).not.toHaveProperty('drainageReportTargets');
|
||||
});
|
||||
|
||||
it('returns the filtered total of signature channel-carrier details still awaiting batch generation', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
prisma.smsSignature.findMany.mockImplementation(({ where }) => {
|
||||
if (where?.AND) {
|
||||
return Promise.resolve([
|
||||
{
|
||||
id: 'sig-pending',
|
||||
applicationId: 'app-1',
|
||||
materialVersion: 2,
|
||||
application: { status: 'active' },
|
||||
reportTasks: [
|
||||
{ channelId: 'channel-1', carrier: 'mobile', status: 'abandoned', approvalScope: 'carrier_specific' },
|
||||
],
|
||||
reportBatchItems: [],
|
||||
},
|
||||
]);
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
});
|
||||
prisma.channelRouteRule.findMany.mockResolvedValue([
|
||||
{
|
||||
applicationId: 'app-1',
|
||||
group: {
|
||||
status: 'active',
|
||||
items: [
|
||||
{
|
||||
channel: {
|
||||
id: 'channel-1',
|
||||
status: 'active',
|
||||
carrier: 'mobile',
|
||||
carriers: ['mobile', 'unicom'],
|
||||
reportFields: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
] as never);
|
||||
const service = new SmsConfigService(prisma as never);
|
||||
|
||||
const result = await service.listSignaturesPage({ signatureKeyword: '测试', page: 1, pageSize: 10 });
|
||||
|
||||
expect(result.pendingReportDetailTotal).toBe(1);
|
||||
expect(prisma.smsSignature.findMany).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: { AND: [expect.objectContaining({ name: { contains: '测试' } }), { auditStatus: 'approved', pendingReport: true }] },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'【带 空格】',
|
||||
' 【外部空格】',
|
||||
|
||||
Reference in New Issue
Block a user