From 8c5c99447bc6f53a291d7f3f629c738e1938a311 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 6 Mar 2024 20:19:15 -0300 Subject: src/hero.mjs: Add minimalistic "ping" action for doing smoke tests in production --- tests/js/hero.mjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/js/hero.mjs') 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 => { -- cgit v1.2.3