import { Test, TestingModule } from '@nestjs/testing';
import { HealthController } from './health.controller';

describe('HealthController', () => {
  let app: TestingModule;

  beforeAll(async () => {
    app = await Test.createTestingModule({
      controllers: [HealthController],
    }).compile();
  });

  describe('liveness', () => {
    it('returns status ok with process metadata', () => {
      const controller = app.get<HealthController>(HealthController);
      const result = controller.liveness();

      expect(result).toMatchObject({
        status: 'ok',
        service: expect.any(String),
        version: expect.any(String),
      });
      expect(result.uptimeSeconds).toBeGreaterThanOrEqual(0);
    });
  });
});
