feat(consistency): 增加V2.5一致性校验
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Reflector } from '@nestjs/core';
|
||||
import { PERMISSION_METADATA_KEY } from '../../common/auth/permission.decorator';
|
||||
import { ConsistencyController } from './consistency.controller';
|
||||
|
||||
describe('ConsistencyController', () => {
|
||||
it('requires consistency:view for consistency checks', () => {
|
||||
const metadata = new Reflector().get(PERMISSION_METADATA_KEY, ConsistencyController.prototype.run);
|
||||
|
||||
expect(metadata).toEqual({ permission: 'consistency:view' });
|
||||
});
|
||||
|
||||
it('delegates consistency checks to the service', async () => {
|
||||
const service = { run: jest.fn().mockResolvedValue({ status: 'pass' }) };
|
||||
const controller = new ConsistencyController(service as any);
|
||||
|
||||
await expect(controller.run()).resolves.toEqual({ status: 'pass' });
|
||||
expect(service.run).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user