import { describe, expect, it } from "vitest" import { homeVariantFromPathname, homeVariantPath, isHomeVariant, } from "@/hooks/use-home-variant" describe("homeVariantPath", () => { it("builds an explicit layout URL for each approach", () => { expect(homeVariantPath("storefront")).toBe("/home/storefront") expect(homeVariantPath("storefront-v2")).toBe("/home/storefront-v2") expect(homeVariantPath("focus")).toBe("/home/focus") expect(homeVariantPath("spotlight")).toBe("/home/spotlight") expect(homeVariantPath("spotlight-v2")).toBe("/home/spotlight-v2") expect(homeVariantPath("spotlight-v3")).toBe("/home/spotlight-v3") expect(homeVariantPath("spotlight-v4")).toBe("/home/spotlight-v4") expect(homeVariantPath("launcher")).toBe("/home/launcher") expect(homeVariantPath("campus")).toBe("/home/campus") expect(homeVariantPath("campus-v3")).toBe("/home/campus-v3") expect(homeVariantPath("catalog")).toBe("/home/catalog") }) }) describe("isHomeVariant", () => { it("accepts the ten layout ids", () => { expect(isHomeVariant("storefront")).toBe(true) expect(isHomeVariant("storefront-v2")).toBe(true) expect(isHomeVariant("focus")).toBe(true) expect(isHomeVariant("spotlight")).toBe(true) expect(isHomeVariant("spotlight-v2")).toBe(true) expect(isHomeVariant("spotlight-v3")).toBe(true) expect(isHomeVariant("spotlight-v4")).toBe(true) expect(isHomeVariant("launcher")).toBe(true) expect(isHomeVariant("campus")).toBe(true) expect(isHomeVariant("campus-v3")).toBe(true) expect(isHomeVariant("catalog")).toBe(true) }) it("rejects product marketing slugs", () => { expect(isHomeVariant("prism")).toBe(false) expect(isHomeVariant("one-schools")).toBe(false) expect(isHomeVariant("")).toBe(false) }) }) describe("homeVariantFromPathname", () => { it("reads the layout from an explicit home URL", () => { expect(homeVariantFromPathname("/home/focus")).toBe("focus") expect(homeVariantFromPathname("/home/storefront-v2")).toBe("storefront-v2") expect(homeVariantFromPathname("/home/spotlight/")).toBe("spotlight") expect(homeVariantFromPathname("/home/spotlight-v2")).toBe("spotlight-v2") expect(homeVariantFromPathname("/home/spotlight-v3")).toBe("spotlight-v3") expect(homeVariantFromPathname("/home/spotlight-v4")).toBe("spotlight-v4") expect(homeVariantFromPathname("/home/campus")).toBe("campus") expect(homeVariantFromPathname("/home/campus-v3")).toBe("campus-v3") expect(homeVariantFromPathname("/home/catalog")).toBe("catalog") }) it("returns null for bare home, nested paths, and marketing slugs", () => { expect(homeVariantFromPathname("/home")).toBeNull() expect(homeVariantFromPathname("/home/prism")).toBeNull() expect(homeVariantFromPathname("/home/focus/extra")).toBeNull() expect(homeVariantFromPathname("/prism/dashboard")).toBeNull() }) })