🐛 Fix nitrate penpot-version schema

This commit is contained in:
Pablo Alba 2026-05-05 16:50:59 +02:00 committed by Pablo Alba
parent 41996ed9a5
commit 2fbab08bde
2 changed files with 23 additions and 6 deletions

View File

@ -64,13 +64,26 @@
;; ---- API: get-penpot-version
(def ^:private schema:get-penpot-version-result
[:map [:version ::sm/text]])
[:map
[:version
[:map
[:full [:maybe ::sm/text]]
[:branch [:maybe ::sm/text]]
[:base [:maybe ::sm/text]]
[:main [:maybe ::sm/text]]
[:major [:maybe ::sm/text]]
[:minor [:maybe ::sm/text]]
[:patch [:maybe ::sm/text]]
[:modifier [:maybe ::sm/text]]
[:commit [:maybe ::sm/text]]
[:commit-hash [:maybe ::sm/text]]]]])
(sv/defmethod ::get-penpot-version
"Get the current Penpot version"
{::doc/added "2.14"
::sm/params [:map]
::sm/result schema:get-penpot-version-result}
::sm/result schema:get-penpot-version-result
::rpc/auth false}
[_cfg _params]
{:version cf/version})

View File

@ -45,11 +45,15 @@
(t/is (= :authentication-required (th/ex-code (:error out))))))
(t/deftest get-penpot-version
(let [profile (th/create-profile* 1 {:is-active true})
out (management-command-with-nitrate! {::th/type :get-penpot-version
::rpc/profile-id (:id profile)})]
(let [out (management-command-with-nitrate! {::th/type :get-penpot-version})
version (-> out :result :version)]
(t/is (th/success? out))
(t/is (= cf/version (-> out :result :version)))))
(t/is (= #{:full :branch :base :main :major :minor :patch :modifier :commit :commit-hash}
(set (keys version))))
(doseq [k [:full :branch :base :main :major :minor :patch :modifier :commit :commit-hash]]
(t/is (or (nil? (get version k))
(string? (get version k)))))
(t/is (= cf/version version))))
(t/deftest get-teams-returns-only-owned-non-default-non-deleted
(let [profile (th/create-profile* 1 {:is-active true})