dcabd288dbaa0c44daac4727c1d94200baebcc75 — Martin Angers 7 months ago d820dbb
test pipe combination
1 files changed, 10 insertions(+), 0 deletions(-)

M test/pipeAsync.test.js
M test/pipeAsync.test.js => test/pipeAsync.test.js +10 -0
@@ 58,3 58,13 @@ test ('rejected promise throws', async t => {
   const main = pipeAsync ([1, () => Promise.resolve (2), reject, () => Promise.resolve (3)])
   await t.throwsAsync (main (4), 'e')
 })
+
+test ('combines pipes', t => {
+  const delay = (v) => new Promise ((resolve, reject) => {
+    setTimeout (() => resolve (v + 1), 100)
+  })
+  const pipe1 = pipeAsync ([2, delay])
+  const pipe2 = pipeAsync ([delay, delay])
+  const pipe3 = pipeAsync ([pipe1, pipe2])
+  return pipe3 (0).then (got => t.is (got, 5))
+})