mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 05:50:35 +00:00
📎 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
This commit is contained in:
parent
3b790cdbe9
commit
86e622ed44
@ -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
|
||||
[]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user