// smoke: GET /api/v1/health
// Covers: normal.PingData health endpoint.
import { get, checkEnvelope } from '../lib/http.js';

export const options = {
  vus: 1,
  iterations: 1,
  thresholds: {
    checks: ['rate==1.0'],
    http_req_failed: ['rate==0.0'],
    http_req_duration: ['p(95)<500'],
  },
};

export default function () {
  const res = get('/api/v1/health');
  const body = checkEnvelope(res, 'GET /api/v1/health');
  if (!body || !body.data || typeof body.data.pong !== 'string') {
    throw new Error(`unexpected payload: ${res.body}`);
  }
}
