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

parser.test.ts — ui Source File

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

Entity Profile

Dependency Diagram

graph LR
  1a2f6559_b009_3e8e_9e06_bd17b668e76b["parser.test.ts"]
  653618de_8a1a_fdc1_3a0b_e1c479d72984["parser.ts"]
  1a2f6559_b009_3e8e_9e06_bd17b668e76b --> 653618de_8a1a_fdc1_3a0b_e1c479d72984
  2e667fd3_c5cb_c8f8_4ba8_e2c7c337a609["parseRegistryAndItemFromString"]
  1a2f6559_b009_3e8e_9e06_bd17b668e76b --> 2e667fd3_c5cb_c8f8_4ba8_e2c7c337a609
  c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"]
  1a2f6559_b009_3e8e_9e06_bd17b668e76b --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8
  style 1a2f6559_b009_3e8e_9e06_bd17b668e76b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

import { parseRegistryAndItemFromString } from "./parser"

describe("parseRegistryAndItemFromString", () => {
  describe("valid registry items", () => {
    it.each([
      ["@v0/button", { registry: "@v0", item: "button" }],
      ["@acme/data-table", { registry: "@acme", item: "data-table" }],
      [
        "@company/nested/component",
        { registry: "@company", item: "nested/component" },
      ],
      ["@test/simple", { registry: "@test", item: "simple" }],
      ["@my-registry/item", { registry: "@my-registry", item: "item" }],
      ["@my_registry/item", { registry: "@my_registry", item: "item" }],
      ["@123registry/item", { registry: "@123registry", item: "item" }],
      ["@registry123/item", { registry: "@registry123", item: "item" }],
      ["@r/item", { registry: "@r", item: "item" }],
      [
        "@very-long-registry-name/item",
        { registry: "@very-long-registry-name", item: "item" },
      ],
    ])("should parse registry item: %s", (input, expected) => {
      expect(parseRegistryAndItemFromString(input)).toEqual(expected)
    })
  })

  describe("non-registry items", () => {
    it.each([
      ["button", { registry: null, item: "button" }],
      ["components/button", { registry: null, item: "components/button" }],
      ["v0/button", { registry: null, item: "v0/button" }],
      ["@button", { registry: null, item: "@button" }],
      ["button@", { registry: null, item: "button@" }],
      ["@", { registry: null, item: "@" }],
      ["@/button", { registry: null, item: "@/button" }],
      ["@-registry/item", { registry: null, item: "@-registry/item" }],
      ["@registry-/item", { registry: null, item: "@registry-/item" }],
      ["@-registry-/item", { registry: null, item: "@-registry-/item" }],
    ])(
      "should return null registry for non-registry item: %s",
      (input, expected) => {
        expect(parseRegistryAndItemFromString(input)).toEqual(expected)
      }
    )
  })

  describe("URLs and external paths", () => {
    it.each([
      [
        "https://example.com/button",
        { registry: null, item: "https://example.com/button" },
      ],
      [
        "http://localhost:3000/component",
        { registry: null, item: "http://localhost:3000/component" },
      ],
      [
        "file:///path/to/component",
// ... (193 more lines)

Frequently Asked Questions

What does parser.test.ts do?
parser.test.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain.
What does parser.test.ts depend on?
parser.test.ts imports 3 module(s): parseRegistryAndItemFromString, parser.ts, vitest.
Where is parser.test.ts in the architecture?
parser.test.ts is located at packages/shadcn/src/registry/parser.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