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

namespaces.test.ts — ui Source File

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

Entity Profile

Dependency Diagram

graph LR
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55["namespaces.test.ts"]
  913f04e7_90de_d0b5_5068_4dacd40de96e["get-config.ts"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> 913f04e7_90de_d0b5_5068_4dacd40de96e
  01ad0f79_968a_e85b_5aa4_a9aceb0aa35c["Config"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> 01ad0f79_968a_e85b_5aa4_a9aceb0aa35c
  d744d254_6b65_468b_eaec_4ea77ab71ad7["constants.ts"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> d744d254_6b65_468b_eaec_4ea77ab71ad7
  f7f7a7b3_695f_ee49_7087_eefcb981b572["errors.ts"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> f7f7a7b3_695f_ee49_7087_eefcb981b572
  ba75c0c1_4005_6319_a4e0_895a6ec89821["RegistryNotConfiguredError"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> ba75c0c1_4005_6319_a4e0_895a6ec89821
  297db2a9_924f_f0dd_ef7f_dae1d3314091["namespaces.ts"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> 297db2a9_924f_f0dd_ef7f_dae1d3314091
  42e6b9b5_85dc_9b2b_3b20_d2a846886ce1["resolveRegistryNamespaces"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> 42e6b9b5_85dc_9b2b_3b20_d2a846886ce1
  c819bacb_5122_731b_64d6_d23131b1f806["resolver.ts"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> c819bacb_5122_731b_64d6_d23131b1f806
  c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"]
  9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8
  style 9ef55c05_4ae8_de0d_13ee_4570ec1b1c55 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { beforeEach, describe, expect, it, vi } from "vitest"

import { Config } from "../utils/get-config"
import { BUILTIN_REGISTRIES } from "./constants"
import { RegistryNotConfiguredError } from "./errors"
import { resolveRegistryNamespaces } from "./namespaces"
import * as resolver from "./resolver"

// Mock the resolver module.
vi.mock("./resolver", () => ({
  fetchRegistryItems: vi.fn(),
}))

// Test utility function to check namespace configuration.
function checkNamespaceConfiguration(
  namespaces: string[],
  config: Config
): { configured: string[]; missing: string[] } {
  const configured: string[] = []
  const missing: string[] = []

  for (const namespace of namespaces) {
    if (BUILTIN_REGISTRIES[namespace] || config.registries?.[namespace]) {
      configured.push(namespace)
    } else {
      missing.push(namespace)
    }
  }

  return { configured, missing }
}

describe("resolveRegistryNamespaces", () => {
  const mockConfig: Config = {
    style: "default",
    tailwind: {
      config: "tailwind.config.js",
      css: "app/globals.css",
      baseColor: "slate",
      cssVariables: true,
    },
    rsc: true,
    tsx: true,
    aliases: {
      components: "@/components",
      utils: "@/lib/utils",
      ui: "@/components/ui",
      lib: "@/lib",
      hooks: "@/hooks",
    },
    resolvedPaths: {
      cwd: "/test",
      tailwindConfig: "/test/tailwind.config.js",
      tailwindCss: "/test/app/globals.css",
      utils: "/test/lib/utils",
      components: "/test/components",
      ui: "/test/components/ui",
      lib: "/test/lib",
      hooks: "/test/hooks",
    },
// ... (410 more lines)

Subdomains

Frequently Asked Questions

What does namespaces.test.ts do?
namespaces.test.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in namespaces.test.ts?
namespaces.test.ts defines 1 function(s): checkNamespaceConfiguration.
What does namespaces.test.ts depend on?
namespaces.test.ts imports 9 module(s): Config, RegistryNotConfiguredError, constants.ts, errors.ts, get-config.ts, namespaces.ts, resolveRegistryNamespaces, resolver.ts, and 1 more.
Where is namespaces.test.ts in the architecture?
namespaces.test.ts is located at packages/shadcn/src/registry/namespaces.test.ts (domain: FrameworkTooling, subdomain: SchemaValidation, 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