@refinedev/core
Version:
Refine is a React meta-framework for building enterprise-level, data-intensive applications rapidly with support for modern UI libraries and headless integrations.
19 lines (15 loc) • 519 B
text/typescript
import { pickRouteParams } from "../pick-route-params";
describe("pickRouteParams", () => {
it("should extract route params from a path", () => {
expect(pickRouteParams("/users/:id/posts/:postId")).toEqual([
"id",
"postId",
]);
});
it("should return an empty array if no route params are given", () => {
expect(pickRouteParams("/users/list")).toEqual([]);
});
it("should extract route params from a path", () => {
expect(pickRouteParams("users/:id")).toEqual(["id"]);
});
});