Home / File/ builder.test.ts — ui Source File

builder.test.ts — ui Source File

Architecture documentation for builder.test.ts, a typescript file in the ui codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302["builder.test.ts"]
  8c5b2947_9033_b37b_2596_f9777d2a7f77["builder.ts"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> 8c5b2947_9033_b37b_2596_f9777d2a7f77
  67a74cd4_d18f_78b8_c357_210cbfc4e92a["buildHeadersFromRegistryConfig"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> 67a74cd4_d18f_78b8_c357_210cbfc4e92a
  b89897ed_a718_3b68_b54b_4dbc4c63943b["buildUrlAndHeadersForRegistryItem"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> b89897ed_a718_3b68_b54b_4dbc4c63943b
  54b97bda_af9c_6ff3_2991_48d3997a5614["buildUrlFromRegistryConfig"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> 54b97bda_af9c_6ff3_2991_48d3997a5614
  6046d561_51c8_77b1_6ef2_3be75ddbac07["resolveRegistryUrl"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> 6046d561_51c8_77b1_6ef2_3be75ddbac07
  2ae56314_aa15_5495_52a2_137787e7b210["constants"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> 2ae56314_aa15_5495_52a2_137787e7b210
  c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"]
  b14232bc_8c42_35f7_fc72_f9cbe7c4e302 --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8
  style b14232bc_8c42_35f7_fc72_f9cbe7c4e302 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* eslint-disable turbo/no-undeclared-env-vars */

import { REGISTRY_URL } from "@/src/registry/constants"
import { afterEach, beforeEach, describe, expect, it } from "vitest"

import {
  buildHeadersFromRegistryConfig,
  buildUrlAndHeadersForRegistryItem,
  buildUrlFromRegistryConfig,
  resolveRegistryUrl,
} from "./builder"

describe("buildUrlFromRegistryConfig", () => {
  beforeEach(() => {
    process.env.TEST_TOKEN = "abc123"
    process.env.API_VERSION = "v2"
    process.env.API_KEY = "key456"
  })

  afterEach(() => {
    delete process.env.TEST_TOKEN
    delete process.env.API_VERSION
    delete process.env.API_KEY
  })

  it("should build URL from string config", () => {
    const url = buildUrlFromRegistryConfig(
      "chat-component",
      "https://v0.dev/chat/b/{name}/json"
    )
    expect(url).toBe("https://v0.dev/chat/b/chat-component/json")
  })

  it("should replace style placeholder in URL", () => {
    const url = buildUrlFromRegistryConfig(
      "button",
      "https://ui.shadcn.com/r/styles/{style}/{name}.json",
      { style: "new-york" } as any
    )
    expect(url).toBe("https://ui.shadcn.com/r/styles/new-york/button.json")
  })

  it("should handle both name and style placeholders", () => {
    const url = buildUrlFromRegistryConfig(
      "accordion",
      "https://example.com/{style}/components/{name}",
      { style: "default" } as any
    )
    expect(url).toBe("https://example.com/default/components/accordion")
  })

  it("should build URL with env vars", () => {
    const url = buildUrlFromRegistryConfig(
      "button",
      "https://api.com/{name}?token=${TEST_TOKEN}"
    )
    expect(url).toBe("https://api.com/button?token=abc123")
  })

  it("should build URL with params", () => {
// ... (421 more lines)

Frequently Asked Questions

What does builder.test.ts do?
builder.test.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain.
What does builder.test.ts depend on?
builder.test.ts imports 7 module(s): buildHeadersFromRegistryConfig, buildUrlAndHeadersForRegistryItem, buildUrlFromRegistryConfig, builder.ts, constants, resolveRegistryUrl, vitest.
Where is builder.test.ts in the architecture?
builder.test.ts is located at packages/shadcn/src/registry/builder.test.ts (domain: FrameworkTooling, directory: packages/shadcn/src/registry).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free