import Fastify from 'fastify';
import { describe, expect, it } from 'vitest';
import { registerHealthRoutes } from '../index.js';

describe('health module API', () => {
  it('GET /health returns 200 and status ok', async () => {
    const app = Fastify({ logger: false });
    await app.register(async (instance) => {
      await registerHealthRoutes(instance);
    });

    const response = await app.inject({ method: 'GET', url: '/health' });

    expect(response.statusCode).toBe(200);
    expect(response.json()).toEqual({ status: 'ok' });
    await app.close();
  });
});
