import { getActiveNavPath } from "@/config/menu"; import { describe, expect, it } from "vitest"; describe("getActiveNavPath", () => { it.each([ ["/", "/"], ["/vendors", "/vendors"], ["/vendors/42", "/vendors"], ["/vendors/42/edit", "/vendors"], ["/vendors/insights", "/vendors/insights"], ["/vendors/preferences", "/vendors/preferences"], ["/vendor-pos/42", "/vendor-pos"], ])("selects one longest boundary-matching route for %s", (pathname, expectedPath) => { expect(getActiveNavPath(pathname)).toBe(expectedPath); }); it("does not match partial route segments", () => { expect(getActiveNavPath("/vendor-posts")).toBeUndefined(); }); });