fetcher.test.ts — ui Source File
Architecture documentation for fetcher.test.ts, a typescript file in the ui codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c2fb9011_4efa_7368_983e_e7685977db7c["fetcher.test.ts"] 16316120_c278_1dd6_844b_6f1683d22437["fetcher.ts"] c2fb9011_4efa_7368_983e_e7685977db7c --> 16316120_c278_1dd6_844b_6f1683d22437 07c31e1c_9a99_d9bb_ba07_6c4ef7280435["clearRegistryCache"] c2fb9011_4efa_7368_983e_e7685977db7c --> 07c31e1c_9a99_d9bb_ba07_6c4ef7280435 9f199ac7_f8ed_fb51_bdb3_647d06922390["fetchRegistry"] c2fb9011_4efa_7368_983e_e7685977db7c --> 9f199ac7_f8ed_fb51_bdb3_647d06922390 2ae56314_aa15_5495_52a2_137787e7b210["constants"] c2fb9011_4efa_7368_983e_e7685977db7c --> 2ae56314_aa15_5495_52a2_137787e7b210 0ec72e6a_72c2_0fcf_92e9_0b0612e46d40["errors"] c2fb9011_4efa_7368_983e_e7685977db7c --> 0ec72e6a_72c2_0fcf_92e9_0b0612e46d40 27f2e161_02ba_b306_ebb2_2005f19d5e8f["msw"] c2fb9011_4efa_7368_983e_e7685977db7c --> 27f2e161_02ba_b306_ebb2_2005f19d5e8f 3d9aab46_cc72_0f62_69b5_c62f35b9b7eb["node"] c2fb9011_4efa_7368_983e_e7685977db7c --> 3d9aab46_cc72_0f62_69b5_c62f35b9b7eb c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"] c2fb9011_4efa_7368_983e_e7685977db7c --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8 style c2fb9011_4efa_7368_983e_e7685977db7c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { REGISTRY_URL } from "@/src/registry/constants"
import {
RegistryFetchError,
RegistryForbiddenError,
RegistryNotFoundError,
RegistryUnauthorizedError,
} from "@/src/registry/errors"
import { HttpResponse, http } from "msw"
import { setupServer } from "msw/node"
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest"
import { clearRegistryCache, fetchRegistry } from "./fetcher"
const server = setupServer(
http.get(`${REGISTRY_URL}/test.json`, () => {
return HttpResponse.json({
name: "test",
type: "registry:ui",
})
}),
http.get(`${REGISTRY_URL}/error.json`, () => {
return HttpResponse.error()
}),
http.get(`${REGISTRY_URL}/not-found.json`, () => {
return new HttpResponse(null, { status: 404 })
}),
http.get(`${REGISTRY_URL}/unauthorized.json`, () => {
return new HttpResponse(null, { status: 401 })
}),
http.get(`${REGISTRY_URL}/forbidden.json`, () => {
return new HttpResponse(null, { status: 403 })
}),
http.get("https://external.com/component.json", () => {
return HttpResponse.json({
name: "external",
type: "registry:ui",
})
})
)
beforeAll(() => server.listen())
afterEach(() => {
server.resetHandlers()
clearRegistryCache()
})
afterAll(() => server.close())
describe("fetchRegistry", () => {
it("should fetch a single registry item", async () => {
const result = await fetchRegistry(["test.json"])
expect(result).toHaveLength(1)
expect(result[0]).toMatchObject({
name: "test",
type: "registry:ui",
})
})
it("should fetch multiple registry items in parallel", async () => {
const result = await fetchRegistry(["test.json", "test.json"])
expect(result).toHaveLength(2)
// ... (163 more lines)
Domain
Subdomains
Functions
Dependencies
- clearRegistryCache
- constants
- errors
- fetchRegistry
- fetcher.ts
- msw
- node
- vitest
Source
Frequently Asked Questions
What does fetcher.test.ts do?
fetcher.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 fetcher.test.ts?
fetcher.test.ts defines 1 function(s): server.
What does fetcher.test.ts depend on?
fetcher.test.ts imports 8 module(s): clearRegistryCache, constants, errors, fetchRegistry, fetcher.ts, msw, node, vitest.
Where is fetcher.test.ts in the architecture?
fetcher.test.ts is located at packages/shadcn/src/registry/fetcher.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