UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

32 lines (31 loc) 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var path_1 = require("./path"); var pipe_1 = require("./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_1.path(testData.t1.obj, testData.t1.path)).toEqual(testData.t1.expect); }); }); describe('data last', function () { test('1 level', function () { expect(pipe_1.pipe(testData.t1.obj, path_1.path(testData.t1.path))).toEqual(testData.t1.expect); }); });