testCreditLinesReadBack

tcmts.cli.contributions.testCreditLinesReadBack · #4c63hgq4 · function

import { contributedBy, creditLine } from "#codebase/tcmts/cli/contributions";

export const testCreditLinesReadBack = () => {
  const line = creditLine({ handle: "grace.test", did: "did:plc:grace" });
  if (line !== "Contributed-by: @grace.test did:plc:grace") throw new Error(line);
  const got = contributedBy(`merge #3: Cubes\nCubes\n\nFaster.\n\n${line}`);
  if (got?.handle !== "grace.test" || got.did !== "did:plc:grace")
    throw new Error(JSON.stringify(got));
  if (contributedBy("merge #3: Cubes\nsays Contributed-by: @x did:plc:y in passing") !== undefined)
    throw new Error("only a line of its own credits anyone");
}

uses