x402-smartperps / tree / test/desc-length.test.js ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
import test from 'node:test';
import assert from 'node:assert/strict';
import { ROUTES } from '../src/tool.js';

// CDP rejects payments when the x402 resource description is over 500 characters.
test('every paid route description is 1-500 characters', () => {
  for (const r of ROUTES) assert.ok(r.desc && r.desc.length <= 500, `${r.path}: ${r.desc?.length} chars`);
});
test('every paid route description keeps the NFA line', () => {
  for (const r of ROUTES) assert.match(r.desc, /Not financial advice/, r.path);
});
test('wallet route keeps the public-data and no-targeting note', () => {
  const w = ROUTES.find((r) => r.path === '/v1/wallet');
  assert.match(w.desc, /Public on-chain data only; must not be used to target or harass account holders\./);
});

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