testPassedRefs
tcmts.cli.placement.testPassedRefs · #htenbgdm · term
import { passedRefs } from "#codebase/tcmts/cli/placement";
export const testPassedRefs = () => {
const ref = (h: string) => ["Ref", h];
const ir = [
"Block",
["CallExpression", ["expression", ref("called")], ["arguments", ["[", ref("argument")]]],
[
"JsxSelfClosingElement",
["tagName", ref("Rendered")],
["attributes", ["JsxAttribute", ["initializer", ref("prop")]]],
],
[
"CallExpression",
[
"expression",
["PropertyAccessExpression", ["expression", ref("bound")], ["name", ["N", "bind"]]],
],
],
];
const got = [...passedRefs(ir)].sort();
if (JSON.stringify(got) !== JSON.stringify(["argument", "bound", "prop"]))
throw new Error(JSON.stringify(got));
}
uses