revert: roll back signature quality period trends

This commit is contained in:
hectorzhao
2026-08-09 23:24:50 +08:00
parent e0c8f82bcf
commit 232d1c22a3
11 changed files with 38 additions and 393 deletions
+3 -21
View File
@@ -677,7 +677,6 @@ describe('OperationsService', () => {
averageArrivalMs: 1200,
rowCount: 12,
}])
.mockResolvedValueOnce([{ count: 4 }])
.mockResolvedValueOnce([
{
signatureId: 'signature-1',
@@ -728,18 +727,6 @@ describe('OperationsService', () => {
averageArrivalMs: 1800,
},
]);
prisma.$queryRaw.mockResolvedValueOnce([
{
signatureId: 'signature-1',
channelId: 'channel-1',
channelName: '通道一',
carrier: 'mobile',
date: '2026-07-24',
businessMessageCount: 3,
deliveredMessageCount: 2,
deliveryRate: 66.7,
},
]);
const service = new OperationsService(prisma as never);
await expect(service.signatureQuality({
@@ -749,7 +736,6 @@ describe('OperationsService', () => {
pageSize: 5,
})).resolves.toEqual({
date: '2026-07-24',
selectedDaySignatureCount: 4,
items: [expect.objectContaining({
signatureId: 'signature-1',
signatureName: '【测试签名】',
@@ -777,31 +763,27 @@ describe('OperationsService', () => {
expect.objectContaining({ channelId: 'channel-1', carrier: 'mobile', drainageState: 'with', total: 4 }),
expect.objectContaining({ channelId: 'channel-2', carrier: 'telecom', drainageState: 'without', total: 2 }),
],
dailyBreakdowns: [
expect.objectContaining({ channelId: 'channel-1', carrier: 'mobile', date: '2026-07-24', businessMessageCount: 3 }),
],
})],
total: 12,
page: 2,
pageSize: 5,
});
expect(prisma.$queryRaw).toHaveBeenCalledTimes(5);
expect(prisma.$queryRaw).toHaveBeenCalledTimes(3);
});
it('does not query channel details when the selected date has no registered signatures', async () => {
const prisma = createPrismaMock();
prisma.$queryRaw.mockResolvedValueOnce([]).mockResolvedValueOnce([{ count: 0 }]);
prisma.$queryRaw.mockResolvedValueOnce([]);
const service = new OperationsService(prisma as never);
await expect(service.signatureQuality({ date: '2026-07-24' })).resolves.toEqual({
date: '2026-07-24',
selectedDaySignatureCount: 0,
items: [],
total: 0,
page: 1,
pageSize: 10,
});
expect(prisma.$queryRaw).toHaveBeenCalledTimes(2);
expect(prisma.$queryRaw).toHaveBeenCalledTimes(1);
});
it('returns trace details and reconciliation diffs', async () => {