summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hero.mjs1
-rw-r--r--tests/js/hero.mjs19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/hero.mjs b/src/hero.mjs
index bcc4fdb..7ac7c19 100644
--- a/src/hero.mjs
+++ b/src/hero.mjs
@@ -285,6 +285,7 @@ export const actionsFn = ({
...loggerGlobals,
},
}),
+ "ping": _ => logger.info({ message: "pong" }),
});
export const actions = actionsFn();
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs
index 14d9a07..4537197 100644
--- a/tests/js/hero.mjs
+++ b/tests/js/hero.mjs
@@ -1196,6 +1196,25 @@ const test_actionsFn = async t => {
]);
});
};
+
+ {
+ t.start(`actionsFn()["ping"]()`);
+
+ await t.test("simple pinging", () => {
+ const contents = [];
+ const logger = { info: x => contents.push(x) };
+ const actions = actionsFn({ logger });
+
+ configLogger({});
+ actions["ping"]("blah");
+ actions["ping"](null);
+
+ assert.deepEqual(contents, [
+ { message: "pong" },
+ { message: "pong" },
+ ]);
+ });
+ };
};
const test_lineHandlerFn = async t => {