summaryrefslogtreecommitdiff
path: root/tests/js/hero.mjs
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-06 12:19:42 -0300
committerEuAndreh <eu@euandre.org>2024-03-06 12:19:42 -0300
commitd866862275d2d131db47cc0ed767ac2df0661a2d (patch)
tree6c924620ba49531dcfd28d12d0770619ec393d37 /tests/js/hero.mjs
parentsrc/hero.mjs: Add makeLineEmitter() (diff)
downloadpapod-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.mjs20
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,
]);