mirror of
https://github.com/penpot/penpot.git
synced 2026-08-19 03:08:40 +00:00
🐛 Add minor fix on token tests
This commit is contained in:
parent
a60b648c6c
commit
495e9f059e
@ -385,18 +385,18 @@
|
|||||||
theme-id (uuid/next)
|
theme-id (uuid/next)
|
||||||
theme (ctob/make-token-theme :id theme-id :group "mode" :name "Light")
|
theme (ctob/make-token-theme :id theme-id :group "mode" :name "Light")
|
||||||
emitted (atom [])
|
emitted (atom [])
|
||||||
invalid (atom [])]
|
errors (atom [])]
|
||||||
(with-redefs [u/locate-token-set (constantly nil)
|
(with-redefs [u/locate-token-set (constantly nil)
|
||||||
u/locate-token-theme (fn [_ id] (when (= id theme-id) theme))
|
u/locate-token-theme (fn [_ id] (when (= id theme-id) theme))
|
||||||
u/not-valid (fn [_ code value] (swap! invalid conj [code value]))
|
u/throw-validation-errors? (constantly true)
|
||||||
dwtl/update-token-theme (fn [id theme] {:id id :theme theme})
|
dwtl/update-token-theme (fn [id theme] {:id id :theme theme})
|
||||||
st/emit! (fn ([event] (swap! emitted conj event) nil)
|
st/emit! (fn ([event] (swap! emitted conj event) nil)
|
||||||
([event & _] (swap! emitted conj event) nil))]
|
([event & _] (swap! emitted conj event) nil))]
|
||||||
(let [theme-proxy (ptok/token-theme-proxy plugin-id file-id theme-id)]
|
(let [theme-proxy (ptok/token-theme-proxy plugin-id file-id theme-id)]
|
||||||
;; Non-id, non-proxy arguments are rejected by the schema coercer.
|
;; Non-id, non-proxy arguments are rejected by the schema coercer.
|
||||||
(.addSet theme-proxy 42)
|
(try (.addSet theme-proxy 42) (catch :default e (swap! errors conj e)))
|
||||||
(.removeSet theme-proxy nil)
|
(try (.removeSet theme-proxy nil) (catch :default e (swap! errors conj e)))
|
||||||
(t/is (empty? @emitted))
|
(t/is (empty? @emitted))
|
||||||
(t/is (= 2 (count @invalid)))
|
(t/is (= 2 (count @errors)))
|
||||||
(t/is (every? #(= :error (first %)) @invalid))))))
|
(t/is (every? #(instance? js/Error %) @errors))))))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user