add.test.ts — ui Source File
Architecture documentation for add.test.ts, a typescript file in the ui codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a4dc2ccb_53f0_1bd7_2946_bd83b4086231["add.test.ts"] d74412ab_0ee4_22df_d4c9_26e6c03c4a41["helpers.ts"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> d74412ab_0ee4_22df_d4c9_26e6c03c4a41 7cd02b67_26ab_6129_7de6_8ec39df1ad51["createFixtureTestDirectory"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> 7cd02b67_26ab_6129_7de6_8ec39df1ad51 e064366d_d787_111b_590e_d9ec019cc193["cssHasProperties"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> e064366d_d787_111b_590e_d9ec019cc193 7080324f_c817_0e10_a2d5_da08756280e2["getRegistryUrl"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> 7080324f_c817_0e10_a2d5_da08756280e2 26ee316c_482d_d5d0_7c05_26095f85f089["npxShadcn"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> 26ee316c_482d_d5d0_7c05_26095f85f089 d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"] a4dc2ccb_53f0_1bd7_2946_bd83b4086231 --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8 style a4dc2ccb_53f0_1bd7_2946_bd83b4086231 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from "path"
import fs from "fs-extra"
import { describe, expect, it } from "vitest"
import {
createFixtureTestDirectory,
cssHasProperties,
getRegistryUrl,
npxShadcn,
} from "../utils/helpers"
// Note: The tests here intentionally do not use a mocked registry.
// We test this against the real registry.
describe("shadcn add", () => {
it("should add item to project", async () => {
const fixturePath = await createFixtureTestDirectory("next-app")
await npxShadcn(fixturePath, ["init", "--base-color=neutral"])
await npxShadcn(fixturePath, ["add", "button"])
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/button.tsx"))
).toBe(true)
})
it("should add multiple items to project", async () => {
const fixturePath = await createFixtureTestDirectory("next-app")
await npxShadcn(fixturePath, ["init", "--base-color=neutral"])
await npxShadcn(fixturePath, ["add", "button", "card"])
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/button.tsx"))
).toBe(true)
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/card.tsx"))
).toBe(true)
})
it("should add item from url", async () => {
const fixturePath = await createFixtureTestDirectory("next-app")
await npxShadcn(fixturePath, ["init", "--base-color=neutral"])
const registryUrl = getRegistryUrl()
const url = `${registryUrl}/styles/new-york-v4/login-01.json`
await npxShadcn(fixturePath, ["add", url])
expect(
await fs.pathExists(path.join(fixturePath, "app/login/page.tsx"))
).toBe(true)
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/button.tsx"))
).toBe(true)
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/card.tsx"))
).toBe(true)
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/input.tsx"))
).toBe(true)
expect(
await fs.pathExists(path.join(fixturePath, "components/ui/label.tsx"))
).toBe(true)
})
// ... (411 more lines)
Domain
Dependencies
Source
Frequently Asked Questions
What does add.test.ts do?
add.test.ts is a source file in the ui codebase, written in typescript. It belongs to the ComponentRegistry domain.
What does add.test.ts depend on?
add.test.ts imports 8 module(s): createFixtureTestDirectory, cssHasProperties, fs-extra, getRegistryUrl, helpers.ts, npxShadcn, path, vitest.
Where is add.test.ts in the architecture?
add.test.ts is located at packages/tests/src/tests/add.test.ts (domain: ComponentRegistry, directory: packages/tests/src/tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free