fix: simplify balance billing and govern operation logs
This commit is contained in:
@@ -437,6 +437,36 @@ describe('SmsConfigService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
['heartbeat', 'lastHeartbeatAt'],
|
||||
['submit', 'lastSubmitAt'],
|
||||
['deliver', 'lastDeliverAt'],
|
||||
] as const)('updates downstream %s state without appending high-frequency operation logs', async (status, timestampField) => {
|
||||
const prisma = createPrismaMock();
|
||||
prisma.cmppDownstreamConnection.findUnique.mockResolvedValue({
|
||||
id: 'downstream-1',
|
||||
connectedAt: new Date('2026-07-11T11:00:00.000Z'),
|
||||
lastHeartbeatAt: new Date('2026-07-11T11:00:00.000Z'),
|
||||
lastSubmitAt: null,
|
||||
lastDeliverAt: null,
|
||||
lastError: null,
|
||||
});
|
||||
const service = new SmsConfigService(prisma as never);
|
||||
|
||||
await service.recordDownstreamConnectionEvent({
|
||||
account: '100001',
|
||||
connectionId: 'gateway-1-1',
|
||||
status,
|
||||
observedAt: '2026-07-11T11:00:30.000Z',
|
||||
});
|
||||
|
||||
expect(prisma.cmppDownstreamConnection.update).toHaveBeenCalledWith(expect.objectContaining({
|
||||
where: { id: 'downstream-1' },
|
||||
data: expect.objectContaining({ [timestampField]: new Date('2026-07-11T11:00:30.000Z') }),
|
||||
}));
|
||||
expect(prisma.operationLog.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('lists enterprise signatures with keyword filters and real relations', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new SmsConfigService(prisma as never);
|
||||
|
||||
Reference in New Issue
Block a user