diff options
author | EuAndreh <eu@euandre.org> | 2024-03-06 12:19:42 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-03-06 12:19:42 -0300 |
commit | d866862275d2d131db47cc0ed767ac2df0661a2d (patch) | |
tree | 6c924620ba49531dcfd28d12d0770619ec393d37 /tests/js/hero.mjs | |
parent | src/hero.mjs: Add makeLineEmitter() (diff) | |
download | papod-d866862275d2d131db47cc0ed767ac2df0661a2d.tar.gz papod-d866862275d2d131db47cc0ed767ac2df0661a2d.tar.xz |
src/hero.mjs: Add skeleton for makePipeReaderFn()
Diffstat (limited to 'tests/js/hero.mjs')
-rw-r--r-- | tests/js/hero.mjs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs index 1debdc5..d4c6b57 100644 --- a/tests/js/hero.mjs +++ b/tests/js/hero.mjs @@ -33,6 +33,7 @@ import { rmIf, mkfifo, makeLineEmitter, + makePipeReaderFn, buildRoutes, promisifyServer, buildServer, @@ -1369,6 +1370,24 @@ const test_makeLineEmitter = async t => { }); }; +const test_makePipeReaderFn = async t => { + t.start("makePipeReaderFn()"); + + await t.test("we can close it manually with no data", async () => { + const path = "tests/hero-2.pipe"; + const lines = []; + const lineFn = x => lines.push(x); + const makePipeReader = makePipeReaderFn({ lineFn: null }); + }); + + await t.test("closing on pipe EOF reopens", async () => { + const path = "tests/hero-3.pipe"; + const lines = []; + const lineFn = x => lines.push(x); + const makePipeReader = makePipeReaderFn({ lineFn }); + }); +}; + const test_buildRoutes = async t => { t.start("buildRoutes()"); @@ -1604,6 +1623,7 @@ await runner.runTests([ test_rmIf, test_mkfifo, test_makeLineEmitter, + test_makePipeReaderFn, test_promisifyServer, test_buildServer, ]); |