mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-01 22:07:53 +00:00
20 lines
687 B
TypeScript
20 lines
687 B
TypeScript
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();
|
|
});
|
|
});
|