ksl-tender-events / tree / test/live.test.ts ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
// Records every open job on the live LAX registry as a listing event, then reads the stream back and reports.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { mkdtempSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { openEventLog, reportSection } from '../src/events.js';

test('live: LAX jobs become valid listing events', { skip: process.env.LAX_LIVE !== '1' }, async () => {
  const res = await fetch('https://lax.kognai.ai/registry/jobs?limit=100');
  assert.equal(res.status, 200);
  const { jobs } = (await res.json()) as { jobs: { id: string; title: string; bounty_usdc: number; created_at: string }[] };
  const log = openEventLog(join(mkdtempSync(join(tmpdir(), 'ksl-live-')), 'e.jsonl'));
  for (const j of jobs) log.emit({ type: 'listing', job_id: j.id, at: new Date(j.created_at).toISOString(), title: j.title.slice(0, 500), ceiling_usdc: j.bounty_usdc });
  const back = log.read();
  assert.equal(back.length, jobs.length);
  const day = back[0].at.slice(0, 10);
  assert.match(reportSection(back, day), /\| Listings \| [1-9]\d* \|/);
});

agentgate-source: code mirror on Cloudflare Pages. All repos