fix: align signature review and admin operations

This commit is contained in:
hectorzhao
2026-07-27 22:07:51 +08:00
parent 9891ffee23
commit df70b336a0
22 changed files with 326 additions and 57 deletions
+25 -3
View File
@@ -226,7 +226,7 @@ describe('OperationsService', () => {
tenant: true,
application: true,
channel: true,
submitRecords: { include: { channel: true } },
submitRecords: { include: { channel: true, channelGroup: true } },
receiptRecords: { include: { channel: true } },
downstreamDeliveries: {
where: { deliveryType: 'receipt' },
@@ -341,6 +341,13 @@ describe('OperationsService', () => {
it('builds dashboard and statistics aggregates', async () => {
const prisma = createPrismaMock();
prisma.$queryRaw.mockResolvedValueOnce([{
tenantId: 'tenant-1',
tenantName: '租户A',
todaySpendCents: 24000n,
balanceCents: 1000000n,
creditCents: 50000n,
}]);
prisma.cmppDownstreamDelivery.count = jest.fn()
.mockResolvedValueOnce(3)
.mockResolvedValueOnce(2)
@@ -365,6 +372,13 @@ describe('OperationsService', () => {
total: 5,
},
today: expect.objectContaining({ returnedCents: 10 }),
enterpriseSpendRanks: [{
tenantId: 'tenant-1',
tenantName: '租户A',
todaySpendCents: 24000,
balanceCents: 1000000,
creditCents: 50000,
}],
gatewayConnections: [{ status: 'connected', _count: { _all: 1 }, _sum: { currentConnections: 2, desiredConnections: 2 } }],
downstreamDeliverySummary: expect.objectContaining({
pending: 3,
@@ -445,6 +459,8 @@ describe('OperationsService', () => {
tenantName: '租户A',
hasDrainage: false,
total: 5,
acceptedCount: 4,
submitFailureCount: 1,
successCount: 3,
unknownCount: 1,
failureCount: 1,
@@ -488,7 +504,13 @@ describe('OperationsService', () => {
submitFailureRate: 20,
successRate: 60,
})],
signatures: [expect.objectContaining({ signatureId: 'signature-1', signatureName: '【测试签名】', hasDrainage: false })],
signatures: [expect.objectContaining({
signatureId: 'signature-1',
signatureName: '【测试签名】',
hasDrainage: false,
acceptedCount: 4,
submitFailureCount: 1,
})],
applications: [expect.objectContaining({ applicationId: 'app-1', applicationName: '通知应用', tenantName: '租户A', total: 5 })],
});
expect(prisma.$queryRaw).toHaveBeenCalledTimes(4);
@@ -868,7 +890,7 @@ describe('OperationsService', () => {
messageRecord: undefined,
},
include: { channel: true, submitRecord: true },
orderBy: [{ submitId: 'asc' }, { segmentIndex: 'asc' }],
orderBy: [{ createdAt: 'asc' }, { segmentIndex: 'asc' }, { id: 'asc' }],
});
});
});