From 2351a0c8a20cd7d2adc8b752bdf64ea0f6fdf33c Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 14 Oct 2026 16:25:51 +0200 Subject: [PATCH] :paperclip: Count only a thumbnail test's own RPC calls The clear-thumbnail-batch tests mock the RPC and count every call recorded while the mock is installed. A thumbnail deletion batch left over by an earlier test of the suite (a component sync clears the thumbnails of the frames it changes) can call it in that window, so the tests failed in the full frontend run from time to time and passed alone. - The batch tests count the calls about their own object ids. - The test that clears an empty queue expected no call at all; a call made by the event under test could only carry no object ids, so it checks that none of the recorded calls is such a call. AI-assisted-by: claude-opus-5-5 --- .../data/workspace_thumbnails_test.cljs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/test/frontend_tests/data/workspace_thumbnails_test.cljs b/frontend/test/frontend_tests/data/workspace_thumbnails_test.cljs index d5360b60b6..3890b6b696 100644 --- a/frontend/test/frontend_tests/data/workspace_thumbnails_test.cljs +++ b/frontend/test/frontend_tests/data/workspace_thumbnails_test.cljs @@ -186,6 +186,13 @@ [file-id n] (vec (repeatedly n #(thc/fmt-object-id file-id (uuid/next) (uuid/next) "frame")))) +(defn- calls-for + "The recorded RPC calls about the thumbnails `oids`: a batch left over by + an earlier test can call the mock while it is installed." + [oids] + (let [own? (set oids)] + (filterv #(some own? (get-in % [:params :object-ids])) @mock/rpc-calls))) + (t/deftest clear-thumbnail-batch-watch-calls-rpc-with-object-ids (t/async done @@ -204,8 +211,8 @@ (fn [_] nil) (fn [err] (t/is (nil? err)) (done')) (fn [_] - (t/is (= 1 (count @mock/rpc-calls))) - (let [[{:keys [cmd params]}] @mock/rpc-calls] + (t/is (= 1 (count (calls-for oids)))) + (let [[{:keys [cmd params]}] (calls-for oids)] (t/is (= :delete-file-object-thumbnails cmd)) (t/is (= (vec oids) (:object-ids params)))) (done'))))) @@ -229,8 +236,8 @@ (fn [_] nil) (fn [err] (t/is (nil? err)) (done')) (fn [_] - (t/is (= 2 (count @mock/rpc-calls))) - (let [[c1 c2] @mock/rpc-calls] + (t/is (= 2 (count (calls-for oids)))) + (let [[c1 c2] (calls-for oids)] (t/is (= :delete-file-object-thumbnails (:cmd c1))) (t/is (= :delete-file-object-thumbnails (:cmd c2))) (t/is (= 200 (count (:object-ids (:params c1))))) @@ -282,7 +289,8 @@ (fn [_] nil) (fn [err] (t/is (nil? err)) (done')) (fn [_] - (t/is (empty? @mock/rpc-calls)) + ;; a call of this event could only carry no object ids + (t/is (not-any? #(empty? (get-in % [:params :object-ids])) @mock/rpc-calls)) (done'))))) done))))