import { assert, assertEquals, assertRejects } from "@std/assert";
import { normalizeWriterIdentityFile } from "../src/utils/writer-identity-file.ts";
import { transformFiles } from "./utils.ts";
import { COMMONFABRIC_TYPES } from "./commonfabric-test-types.ts";
// The claim-minting + provenance-stamping source used across the cases: the
// `typeof saver` type-query mints an `__ctWriterIdentityOf` marker carrying
// this module's writer-identity file spelling.
const CLAIM_SOURCE = `///
import { toSchema, WriteAuthorizedBy, handler } from "commonfabric";
const saver = handler({}, {}, () => {});
const s = toSchema>();
export { s };
`;
// Production schemas (including profile-home) normally carry writer claims on
// properties behind an interface and user alias. This path is emitted by the
// schema-generator's CommonFabricFormatter, not the direct root special case.
const NESTED_CLAIM_SOURCE = `///
import { toSchema, WriteAuthorizedBy, handler } from "commonfabric";
const saver = handler({}, {}, () => {});
type ProtectedTitle = WriteAuthorizedBy;
interface Output { title: ProtectedTitle; }
const s = toSchema