Files
shadcn-ui/packages/cli/test/utils/transform-rsc.test.ts
2023-06-22 22:44:52 +04:00

62 lines
1.0 KiB
TypeScript

import { expect, test } from "vitest"
import { transform } from "../../src/utils/transformers"
test("transform rsc", async () => {
expect(
await transform({
filename: "test.ts",
raw: `import * as React from "react"
import { Foo } from "bar"
`,
config: {
rsc: true,
},
})
).toMatchSnapshot()
expect(
await transform({
filename: "test.ts",
raw: `"use client"
import * as React from "react"
import { Foo } from "bar"
`,
config: {
rsc: true,
},
})
).toMatchSnapshot()
expect(
await transform({
filename: "test.ts",
raw: `"use client"
import * as React from "react"
import { Foo } from "bar"
`,
config: {
rsc: false,
},
})
).toMatchSnapshot()
expect(
await transform({
filename: "test.ts",
raw: `"use foo"
import * as React from "react"
import { Foo } from "bar"
"use client"
`,
config: {
rsc: false,
},
})
).toMatchSnapshot()
})