import { Output, refkey, StatementList } from "@alloy-js/core"; import { expect, it } from "vitest"; import * as ts from "../src/components/index.js"; import { createTSNamePolicy } from "../src/name-policy.js"; it("applies to functions and variables", () => { const ref1 = refkey({}); const ref2 = refkey({}); const namePolicy = createTSNamePolicy(); expect( "hello" , ).toRenderTo(` function fooBar() {} const oneTwo = "hello"; fooBar; oneTwo; `); }); it("keeps _ and $ prefix", () => { const ref1 = refkey({}); const ref2 = refkey({}); const namePolicy = createTSNamePolicy(); expect( "hello" , ).toRenderTo(` function _fooBar() {} const $oneTwo = "hello"; _fooBar; $oneTwo; `); }); it("appends _ to reserved words", () => { const ref1 = refkey({}); const ref2 = refkey({}); const namePolicy = createTSNamePolicy(); expect( "hello" , ).toRenderTo(` function default_(await_: any) {} const super_ = "hello"; default_; super_; `); });