testAttestationsPrintAsText

tcmts.cli.attest.test.testAttestationsPrintAsText · #koihwpdq · term

What others wrote is printed as text: no escape sequences reach the terminal.

import { printAttestations } from "#codebase/tcmts/cli/attest";
import assert from "node:assert/strict";

export const testAttestationsPrintAsText = () => {
  const said: string[] = [];
  const log = console.log;
  console.log = (s: string) => void said.push(s);
  try {
    printAttestations(
      [
        {
          kind: "review",
          subject: { namespace: "n" },
          body: "fine\u001b]52;c;cGF3bmVk\u0007 \u001b[2Jreally",
          createdAt: "2026-11-03",
          uri: "u",
          did: "d",
        },
      ],
      () => "@maya.test",
    );
  } finally {
    console.log = log;
  }
  // eslint-disable-next-line no-control-regex
  assert.ok(!/[\u0000-\u0008\u000b-\u001f\u007f]/.test(said.join("")), JSON.stringify(said));
}

uses