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

schema.test.ts — ui Source File

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

Entity Profile

Dependency Diagram

graph LR
  c60ed853_bfca_7f86_2576_e5b58bb7b8aa["schema.test.ts"]
  d622c874_d9cc_69e4_4150_aadbf45b3cda["schema.ts"]
  c60ed853_bfca_7f86_2576_e5b58bb7b8aa --> d622c874_d9cc_69e4_4150_aadbf45b3cda
  d8706293_b2b2_e40d_c44a_7ae0333a882c["registryConfigSchema"]
  c60ed853_bfca_7f86_2576_e5b58bb7b8aa --> d8706293_b2b2_e40d_c44a_7ae0333a882c
  c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"]
  c60ed853_bfca_7f86_2576_e5b58bb7b8aa --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8
  style c60ed853_bfca_7f86_2576_e5b58bb7b8aa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

import { registryConfigSchema } from "./schema"

describe("registryConfigSchema", () => {
  it("should accept valid registry names starting with @", () => {
    const validConfig = {
      "@v0": "https://v0.dev/{name}.json",
      "@acme": {
        url: "https://acme.com/{name}.json",
        headers: {
          Authorization: "Bearer token",
        },
      },
    }

    const result = registryConfigSchema.safeParse(validConfig)
    expect(result.success).toBe(true)
  })

  it("should reject registry names not starting with @", () => {
    const invalidConfig = {
      v0: "https://v0.dev/{name}.json",
      acme: "https://acme.com/{name}.json",
    }

    const result = registryConfigSchema.safeParse(invalidConfig)
    expect(result.success).toBe(false)
    if (!result.success) {
      expect(result.error.errors[0].message).toContain(
        "Registry names must start with @"
      )
    }
  })

  it("should reject URLs without {name} placeholder", () => {
    const invalidConfig = {
      "@v0": "https://v0.dev/component.json",
    }

    const result = registryConfigSchema.safeParse(invalidConfig)
    expect(result.success).toBe(false)
    if (!result.success) {
      expect(result.error.errors[0].message).toContain(
        "Registry URL must include {name} placeholder"
      )
    }
  })
})

Dependencies

Frequently Asked Questions

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