Home / File/ update-files.test.ts — ui Source File

update-files.test.ts — ui Source File

Architecture documentation for update-files.test.ts, a typescript file in the ui codebase. 12 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  e7f8d696_5931_86ae_9ca8_64e32b66c388["update-files.test.ts"]
  913f04e7_90de_d0b5_5068_4dacd40de96e["get-config.ts"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 913f04e7_90de_d0b5_5068_4dacd40de96e
  accda39a_0dd0_5dea_eb7b_df6ae4616716["getConfig"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> accda39a_0dd0_5dea_eb7b_df6ae4616716
  3efb2c23_7931_d244_b4e1_85acab69298c["update-files.ts"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 3efb2c23_7931_d244_b4e1_85acab69298c
  4b6decbf_93a4_8403_9ccd_daf4d79c041f["findCommonRoot"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 4b6decbf_93a4_8403_9ccd_daf4d79c041f
  ff8d1a68_3ace_911d_7cb3_0e0a0d30e24f["resolveFilePath"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> ff8d1a68_3ace_911d_7cb3_0e0a0d30e24f
  5ca9d691_c347_aaf4_a263_a11c048b0d37["resolveModuleByProbablePath"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 5ca9d691_c347_aaf4_a263_a11c048b0d37
  4986011c_e945_83d0_6884_3ab38bf394a1["resolveNestedFilePath"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 4986011c_e945_83d0_6884_3ab38bf394a1
  6f4fcb58_e322_dd7a_1912_a488aeba98bc["toAliasedImport"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> 6f4fcb58_e322_dd7a_1912_a488aeba98bc
  bc52ca78_0228_54e7_56b2_602b341e2ec4["updateFiles"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> bc52ca78_0228_54e7_56b2_602b341e2ec4
  eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"]
  e7f8d696_5931_86ae_9ca8_64e32b66c388 --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8
  style e7f8d696_5931_86ae_9ca8_64e32b66c388 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { existsSync, promises as fs } from "fs"
import path from "path"
import { afterAll, afterEach, describe, expect, test, vi } from "vitest"

import { getConfig } from "../../../src/utils/get-config"
import {
  findCommonRoot,
  resolveFilePath,
  resolveModuleByProbablePath,
  resolveNestedFilePath,
  toAliasedImport,
  updateFiles,
} from "../../../src/utils/updaters/update-files"

vi.mock("fs/promises", async () => {
  const actual = (await vi.importActual(
    "fs/promises"
  )) as typeof import("fs/promises")

  return {
    ...actual,
    writeFile: vi.fn().mockResolvedValue(undefined),
    readFile: vi.fn().mockImplementation(actual.readFile),
    mkdir: vi.fn().mockResolvedValue(undefined),
  }
})

vi.mock("fs", async () => {
  const actual = (await vi.importActual("fs")) as typeof import("fs")
  return {
    ...actual,
    existsSync: vi.fn().mockImplementation(actual.existsSync),
    promises: {
      ...actual.promises,
      writeFile: vi.fn().mockResolvedValue(undefined),
    },
  }
})

vi.mock("prompts")

afterEach(async () => {
  vi.clearAllMocks()
  // Restore the actual implementation of existsSync after clearing mocks
  const actual = (await vi.importActual("fs")) as typeof import("fs")
  vi.mocked(existsSync).mockImplementation(actual.existsSync)
})

afterAll(() => {
  vi.resetAllMocks()
})

describe("resolveFilePath", () => {
  test.each([
    {
      description: "should use target when provided",
      file: {
        path: "hello-world/ui/button.tsx",
        type: "registry:ui",
        target: "ui/button.tsx",
// ... (1912 more lines)

Frequently Asked Questions

What does update-files.test.ts do?
update-files.test.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain.
What does update-files.test.ts depend on?
update-files.test.ts imports 12 module(s): findCommonRoot, fs, get-config.ts, getConfig, path, resolveFilePath, resolveModuleByProbablePath, resolveNestedFilePath, and 4 more.
Where is update-files.test.ts in the architecture?
update-files.test.ts is located at packages/shadcn/test/utils/updaters/update-files.test.ts (domain: FrameworkTooling, directory: packages/shadcn/test/utils/updaters).

Analyze Your Own Codebase

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

Try Supermodel Free