UNPKG

@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.

52 lines (45 loc) 977 B
import { getParentResource } from "../get-parent-resource"; describe("getParentResource", () => { it("should return undefined if no parent is given", () => { const result = getParentResource( { name: "users", meta: {}, }, [], ); expect(result).toEqual(undefined); }); it("should return the parent resource if parent is given", () => { const result = getParentResource( { name: "users", meta: { parent: "orgs", }, }, [ { name: "orgs", }, ], ); expect(result).toEqual({ name: "orgs", }); }); it("should return the parent resource if parent is given even if the parent is not defined", () => { const result = getParentResource( { name: "users", options: { parent: "orgs", }, }, [], ); expect(result).toEqual({ name: "orgs", }); }); });