compare.test.ts — ui Source File
Architecture documentation for compare.test.ts, a typescript file in the ui codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1734752f_152c_7d66_3858_3587b1cc5578["compare.test.ts"] d5d2f99b_9ade_1fed_4fc0_383bcc559cdd["compare.ts"] 1734752f_152c_7d66_3858_3587b1cc5578 --> d5d2f99b_9ade_1fed_4fc0_383bcc559cdd f986de80_d207_244d_daac_223724e81054["isContentSame"] 1734752f_152c_7d66_3858_3587b1cc5578 --> f986de80_d207_244d_daac_223724e81054 c8d55bee_7008_1e1f_317b_8dc47b31b6a8["vitest"] 1734752f_152c_7d66_3858_3587b1cc5578 --> c8d55bee_7008_1e1f_317b_8dc47b31b6a8 style 1734752f_152c_7d66_3858_3587b1cc5578 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, expect, it } from "vitest"
import { isContentSame } from "./compare"
describe("isContentSame", () => {
describe("basic comparisons", () => {
it("should return true for identical content", () => {
const content = `const foo = "bar"`
expect(isContentSame(content, content)).toBe(true)
})
it("should return true for content with different line endings", () => {
const content1 = `line1\nline2\nline3`
const content2 = `line1\r\nline2\r\nline3`
expect(isContentSame(content1, content2)).toBe(true)
})
it("should return true for content with different whitespace at ends", () => {
const content1 = ` const foo = "bar" `
const content2 = `const foo = "bar"`
expect(isContentSame(content1, content2)).toBe(true)
})
it("should return false for different content", () => {
const content1 = `const foo = "bar"`
const content2 = `const foo = "baz"`
expect(isContentSame(content1, content2)).toBe(false)
})
})
describe("import comparisons with ignoreImports enabled", () => {
it("should return true for different aliased imports to same module", () => {
const content1 = `import { Button } from "@/components/ui/button"`
const content2 = `import { Button } from "~/ui/button"`
expect(isContentSame(content1, content2, { ignoreImports: true })).toBe(
true
)
})
it("should return true for different paths to same final module", () => {
const content1 = `import { cn } from "@/lib/utils"`
const content2 = `import { cn } from "~/utils"`
expect(isContentSame(content1, content2, { ignoreImports: true })).toBe(
true
)
})
it("should preserve relative imports and require exact match", () => {
const content1 = `import { Button } from "./button"`
const content2 = `import { Button } from "../button"`
expect(isContentSame(content1, content2, { ignoreImports: true })).toBe(
false
)
})
it("should handle multiple imports with different aliases", () => {
const content1 = `
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { Card } from "@/components/ui/card"
// ... (201 more lines)
Domain
Dependencies
- compare.ts
- isContentSame
- vitest
Source
Frequently Asked Questions
What does compare.test.ts do?
compare.test.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain.
What does compare.test.ts depend on?
compare.test.ts imports 3 module(s): compare.ts, isContentSame, vitest.
Where is compare.test.ts in the architecture?
compare.test.ts is located at packages/shadcn/src/utils/compare.test.ts (domain: FrameworkTooling, directory: packages/shadcn/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free