import { expect, it } from "vitest";
import { ArrayExpression } from "../src/index.js";
import { TestFile } from "./utils.js";
it("works", () => {
expect(
,
).toRenderTo(`
[1, 2, 3]
`);
expect(
,
).toRenderTo(
`
[
1,
2,
3,
"foofoofoofoofoofoofoofoofoofoo"
]
`,
{
printWidth: 20,
},
);
});
it("accepts children", () => {
expect(
,
).toRenderTo(`
[1, 2, 3, [4, 5, 6]]
`);
});
it("accepts only children", () => {
expect(
,
).toRenderTo(`
[[4, 5, 6]]
`);
});
it("renders a falsy jsValue", () => {
expect(
,
).toRenderTo(`
[undefined]
`);
});
it("renders a falsy jsValue with no leading comma", () => {
expect(
,
).toRenderTo(`
[null]
`);
});
it("renders a falsy jsValue and children", () => {
expect(
"Hello"
,
).toRenderTo(`
[false, "Hello"]
`);
});
it("renders a falsy jsValue but not invisible children", () => {
expect(
{null}
{undefined}
,
).toRenderTo(`
[false]
`);
});
it("renders a falsy jsValue and visible children", () => {
expect(
"Hello"
,
).toRenderTo(`
[false, "Hello"]
`);
});
it("renders a falsy jsValue and visible falsy children", () => {
expect(
false
,
).toRenderTo(`
[false, false]
`);
});
it("renders a falsy jsValue but not invisible falsy children", () => {
expect(
{false}
,
).toRenderTo(`
[false]
`);
});