import {composeAsync, delay, pipeAsync} from 'rambda'
describe('R.composeAsync', () => { it('no need to pass type argument on second function', () => { const result = composeAsync( async x => { x return Promise.resolve(String(x[0])) }, (x: number) => Promise.resolve([x]) )(1)
result }) it('pass type of function input', async() => { const fn = composeAsync( <T>(x: T) => { x return Promise.resolve([x]) }, x => { x return new Promise<string>(resolve => { resolve(x.toString()) }) }, async(x: 4) => { x await delay(100) return x + 1 } )
const result1 = await fn(4) const result2 = await fn(Promise.resolve(4))
result1 result2 })})
describe('R.pipeAsync', () => { it('happy', () => { const result = pipeAsync( (x: number) => Promise.resolve([x]), async x => { x return Promise.resolve(String(x[0])) } )(1)
result })})