import { OpsController } from './ops.controller';

describe('OpsController', () => {
  it('checks the ops:view adapter before returning runtime snapshot', async () => {
    const service = {
      getRuntimeSnapshot: jest.fn().mockResolvedValue({ ok: true }),
    };
    const permissions = {
      assertCanViewOps: jest.fn(),
    };
    const controller = new OpsController(service as any, permissions as any);
    const request = { headers: {} };

    await expect(controller.getRuntime(request as any)).resolves.toEqual({ ok: true });

    expect(permissions.assertCanViewOps).toHaveBeenCalledWith(request);
    expect(service.getRuntimeSnapshot).toHaveBeenCalled();
  });
});
