feat: complete reporting and filing workflows
This commit is contained in:
@@ -8,12 +8,13 @@ function createPrismaMock() {
|
||||
},
|
||||
enterpriseCertification: {
|
||||
create: jest.fn().mockImplementation(({ data }) => Promise.resolve({ id: 'cert-1', ...data })),
|
||||
findMany: jest.fn(),
|
||||
findMany: jest.fn().mockResolvedValue([]),
|
||||
findUnique: jest.fn().mockResolvedValue({ id: 'cert-1', tenantId: 'tenant-1', status: 'pending' }),
|
||||
update: jest.fn().mockImplementation(({ data }) => Promise.resolve({ id: 'cert-1', ...data })),
|
||||
},
|
||||
user: {
|
||||
findUnique: jest.fn().mockResolvedValue({ id: 'reviewer-1' }),
|
||||
findUnique: jest.fn().mockResolvedValue({ id: 'reviewer-1', username: 'reviewer', displayName: '审核员' }),
|
||||
findMany: jest.fn().mockResolvedValue([]),
|
||||
},
|
||||
operationLog: {
|
||||
create: jest.fn(),
|
||||
@@ -22,6 +23,21 @@ function createPrismaMock() {
|
||||
}
|
||||
|
||||
describe('CertificationService', () => {
|
||||
it('returns the reviewer username with enterprise certification records', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
prisma.enterpriseCertification.findMany.mockResolvedValue([
|
||||
{ id: 'cert-1', tenantId: 'tenant-1', reviewerId: 'reviewer-1' },
|
||||
]);
|
||||
prisma.user.findMany.mockResolvedValue([
|
||||
{ id: 'reviewer-1', username: 'reviewer', displayName: '审核员' },
|
||||
]);
|
||||
const service = new CertificationService(prisma as never);
|
||||
|
||||
await expect(service.list()).resolves.toEqual([
|
||||
expect.objectContaining({ reviewer: expect.objectContaining({ username: 'reviewer' }) }),
|
||||
]);
|
||||
});
|
||||
|
||||
it('submits certification and marks tenant pending', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new CertificationService(prisma as never);
|
||||
|
||||
Reference in New Issue
Block a user