From 9592b1cb2e762d92fc18d5fee8d972b7daded2a4 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 15 Oct 2026 15:24:49 +0200 Subject: [PATCH] :paperclip: Count only the plugin calls in the plugin registry tests The registry tests mock the RPC and check every call recorded while the mock is installed. A component sync deletes the thumbnails of the frames it changes 200 ms later, so a sync at the end of an earlier test of the suite can call the mock in that window: under the coverage run, the frontend suite failed in register-test, a different test each time, with an extra :delete-file-object-thumbnails call. The mock now records and answers only the plugin profile commands; any other call gets an empty answer. AI-assisted-by: claude-opus-5-5 --- .../frontend_tests/plugins/register_test.cljs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/test/frontend_tests/plugins/register_test.cljs b/frontend/test/frontend_tests/plugins/register_test.cljs index a4399ab6af..dfeaadd0a4 100644 --- a/frontend/test/frontend_tests/plugins/register_test.cljs +++ b/frontend/test/frontend_tests/plugins/register_test.cljs @@ -18,14 +18,21 @@ (t/is (preg/check-permission preg/mcp-plugin-id "content:write")) (t/is (not (preg/check-permission preg/mcp-plugin-id "unknown:permission")))) +(def ^:private plugin-cmds + #{:add-profile-plugin :remove-profile-plugin}) + (defn- record-cmd-mock - "Mock rp/cmd! that records calls in mock/rpc-calls and answers - with (response-fn cmd params)." + "Mock rp/cmd! that records the plugin calls in mock/rpc-calls and + answers them with (response-fn cmd params). Other calls, left over by + an earlier test of the suite (a component sync deletes the thumbnails + of the frames it changes after a delay), get an empty answer." [response-fn] (mock/stub (fn [cmd params] - (swap! mock/rpc-calls conj {:cmd cmd :params params}) - (response-fn cmd params)))) + (if (contains? plugin-cmds cmd) + (do (swap! mock/rpc-calls conj {:cmd cmd :params params}) + (response-fn cmd params)) + (rx/of nil))))) (defn- cmds []