-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-item-target-path.test.ts
39 lines (34 loc) · 1.13 KB
/
get-item-target-path.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import path from "path"
import { expect, test } from "vitest"
import { getConfig } from "../../src/utils/get-config"
import { getItemTargetPath } from "../../src/utils/registry"
test("get item target path", async () => {
// Full config.
let appDir = path.resolve(__dirname, "../fixtures/config-full")
expect(
await getItemTargetPath(await getConfig(appDir), {
type: "components:ui",
})
).toEqual(path.resolve(appDir, "./src/components/ui"))
// Partial config.
appDir = path.resolve(__dirname, "../fixtures/config-partial")
expect(
await getItemTargetPath(await getConfig(appDir), {
type: "components:ui",
})
).toEqual(path.resolve(appDir, "./components/ui"))
// JSX.
appDir = path.resolve(__dirname, "../fixtures/config-jsx")
expect(
await getItemTargetPath(await getConfig(appDir), {
type: "components:ui",
})
).toEqual(path.resolve(appDir, "./components/ui"))
// Custom paths.
appDir = path.resolve(__dirname, "../fixtures/config-ui")
expect(
await getItemTargetPath(await getConfig(appDir), {
type: "components:ui",
})
).toEqual(path.resolve(appDir, "./src/ui"))
})