import { Output, refkey, StatementList } from "@alloy-js/core"; import { expect, it } from "vitest"; import { FunctionCallExpression, FunctionDeclaration, PackageDirectory, SourceFile, VarDeclaration, } from "../../typescript/src/index.js"; it("can declare and call a function with parameters", () => { const functionRefkey = refkey(); expect( ; <>const message = foo ? foo : "Hello, World!" <>console.log(message) <>if(baz) console.log(baz) "Hello {<>World}!"]} /> "Hey there!"]} /> "Hello World", <>12345]} /> , ).toRenderTo({ "index.ts": ` const foo = "Foo"; function bar(foo?: string, baz?: number) { const message = foo ? foo : "Hello, World!"; console.log(message); if(baz) console.log(baz); } bar("Hello!"); bar(); bar("Hello World!"); bar("Hey there!"); bar("Hello World", 12345); `, "package.json": expect.anything(), "tsconfig.json": expect.anything(), }); });