Files
eden/scripts/smoke-markets.ts
2026-09-18 23:15:05 -04:00

12 lines
877 B
TypeScript

import assert from 'node:assert/strict';
import { EsiClient, EsiMarketEstimates } from '../src/lib/server/esi';
if (process.env.LIVE_API_SMOKE !== '1') throw new Error('Set LIVE_API_SMOKE=1 to make a real public ESI prices request.');
const userAgent = process.env.ESI_USER_AGENT;
if (!userAgent) throw new Error('Set an identifying ESI_USER_AGENT.');
const snapshot = await new EsiMarketEstimates(new EsiClient({ userAgent })).estimates([34, 587]);
assert.equal(snapshot.prices.length, 2);
assert(snapshot.expiresAt > Date.now(), 'price snapshot must be fresh');
for (const price of snapshot.prices) assert(BigInt(price.unitPrice) > 0n);
console.log(JSON.stringify({ publicEsiPrices: 'passed', source: snapshot.source, asOf: snapshot.asOf, expiresAt: snapshot.expiresAt, prices: snapshot.prices, meaning: 'Global reference estimates, not Jita bids or executable quotes' }));