import { path } from "../path"; test("example 1", () => { const route = ["a", "b", "c"]; const xs = { a: { b: { c: 1 } } }; const output = 1; expect(path(route, xs)).toEqual(output); }); test("example 2", () => { const route = ["a", "b"]; const xs = { a: { b: { c: 1 } } }; const output = { c: 1 }; expect(path(route, xs)).toEqual(output); }); test("example 3", () => { const route = ["a", "b", "x"]; const xs = { a: { b: { c: 1 } } }; expect(path(route, xs)).toBeUndefined(); }); test("example 4", () => { const route = ["a", "b", "c"]; const xs = undefined; expect(path(route, xs)).toBeUndefined(); });