ts-prime
Version:
A utility library for JavaScript and Typescript.
30 lines (29 loc) • 737 B
JavaScript
import { path } from './path';
import { pipe } from './pipe';
var testData = {
t1: {
obj: {
a: {
b: {
c: {
d: {
a: [0],
},
},
},
},
},
path: 'a.b.c.d.a.0'.split('.'),
expect: 0,
},
};
describe('data first', function () {
test('1 level', function () {
expect(path(testData.t1.obj, testData.t1.path)).toEqual(testData.t1.expect);
});
});
describe('data last', function () {
test('1 level', function () {
expect(pipe(testData.t1.obj, path(testData.t1.path))).toEqual(testData.t1.expect);
});
});