feat: improve operations diagnostics and channel management
This commit is contained in:
@@ -68,6 +68,29 @@ describe('DeletionGovernanceService', () => {
|
||||
]));
|
||||
});
|
||||
|
||||
it('does not classify approved or abandoned report history as unfinished', async () => {
|
||||
const { service, prisma } = setup();
|
||||
prisma.smsSignature.findFirst.mockResolvedValue({
|
||||
id: 'signature-1', name: '示例签名', auditStatus: 'approved', updatedAt: now,
|
||||
tenant: { name: '示例企业' }, application: { name: '验证码应用' },
|
||||
templates: [], drainageItems: [], reportTasks: [],
|
||||
});
|
||||
|
||||
const result = await service.preflight('signature', 'signature-1', 'tenant-1');
|
||||
|
||||
expect(prisma.smsSignature.findFirst).toHaveBeenCalledWith(expect.objectContaining({
|
||||
include: expect.objectContaining({
|
||||
reportTasks: expect.objectContaining({
|
||||
where: { status: { notIn: expect.arrayContaining(['approved', 'abandoned']) } },
|
||||
}),
|
||||
}),
|
||||
}));
|
||||
expect(result.dependencies).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ kind: 'report_tasks', count: 0 }),
|
||||
]));
|
||||
expect(result.allowedActions).toEqual(['delete']);
|
||||
});
|
||||
|
||||
it('requires version, idempotency key and a meaningful reason', async () => {
|
||||
const { service } = setup();
|
||||
await expect(service.delete('template', 'template-1', {})).rejects.toBeInstanceOf(BadRequestException);
|
||||
|
||||
Reference in New Issue
Block a user