mkdir -p scripts
cat > scripts/smoke.mjs <<'JS'
const base = process.env.BASE_URL || "http://localhost:3000";

async function check(path) {
  const res = await fetch(base + path);
  if (!res.ok) {
    throw new Error(`${path} -> HTTP ${res.status}`);
  }
  const json = await res.json();
  if (!json.ok) {
    throw new Error(`${path} -> ok=false: ${JSON.stringify(json).slice(0, 200)}`);
  }
  return json;
}

(async () => {
  console.log("Smoke tests:", base);

  const jobs = await check("/api/jobs?limit=3");
  console.log("✅ /api/jobs", jobs.count);

  const cand = await check("/api/candidates?limit=3");
  console.log("✅ /api/candidates", cand.count);

  console.log("🎉 Smoke OK");
})().catch((e) => {
  console.error("❌ Smoke FAILED:", e.message);
  process.exit(1);
});
JS

