@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
34 lines (23 loc) • 643 B
text/typescript
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();
});