import {path} from 'rambda'
interface Input { a: number, b: { c: boolean, },}
describe('R.path', () => { it('without specified input type', () => { const input = {a: 1, b: {c: true}} const result = path<boolean>('a.b.c', input) const curriedResult = path<boolean>('a.b.c')(input) result curriedResult })
it('without specified output type', () => { const input = {a: 1, b: {c: true}} const result = path('a.b.c', input) result })
it('with string as path', () => { const input: Input = {a: 1, b: {c: true}} const resultA = path<boolean>('a.b.c', input) const resultB = path<boolean>('a.b.c')(input) resultA resultB }) it('with array as path', () => { const input: Input = {a: 1, b: {c: true}} const resultA = path<boolean>(['a', 'b', 'c'], input) const resultB = path<boolean>(['a', 'b', 'c'])(input) resultA resultB })})
describe('path with specified input', () => { it('with string as path', () => { const input: Input = {a: 1, b: {c: true}} const resultA = path<Input, boolean>('a.b.c', input) const resultB = path<Input, boolean>('a.b.c')(input) resultA resultB }) it('with array as path', () => { const input: Input = {a: 1, b: {c: true}} const resultA = path<Input, boolean>(['a', 'b', 'c'], input) const resultB = path<Input, boolean>(['a', 'b', 'c'])(input) resultA resultB })})