0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Temporary fix for tests [*]

[*] Async tests got broken with the latest upstream.

This will still print a bunch of warnings from rxjs but the tests are
still running.
This commit is contained in:
Florian Schroedl 2024-08-07 12:38:24 +02:00
parent eb9b4be6ea
commit edb89bcccb

View file

@ -1,8 +1,32 @@
(ns token-tests.helpers.state
(:require
[app.main.ui.workspace.tokens.style-dictionary :as sd]
[beicon.v2.core :as rx]
[potok.v2.core :as ptk]))
(defn end
"Apply `attributes` that match `token` for `shape-ids`.
Optionally remove attributes from `attributes-to-remove`,
this is useful for applying a single attribute from an attributes set
while removing other applied tokens from this set."
[]
(ptk/reify ::end
ptk/WatchEvent
(watch [_ _ _]
(rx/empty))))
(defn end+
[]
(ptk/reify ::end+
ptk/WatchEvent
(watch [_ state _]
(->> (rx/from (sd/resolve-tokens+ (get-in state [:workspace-data :tokens])))
(rx/mapcat
(fn [_]
(rx/of
(end))))))))
(defn stop-on
"Helper function to be used with async version of run-store.
@ -15,7 +39,7 @@
(def stop-on-send-update-indices
"Stops on `send-update-indices` function being called, which should be the last function of an event chain."
(stop-on :app.main.data.workspace.changes/send-update-indices))
(stop-on ::end))
;; Support for async events in tests
;; https://chat.kaleidos.net/penpot-partners/pl/tz1yoes3w3fr9qanxqpuhoz3ch
@ -37,7 +61,7 @@
(js/console.log "[error]:" cause))
(fn [_]
#_(js/console.log "[complete]"))))
(doall (for [event events]
(doall (for [event (concat events [(end+)])]
(ptk/emit! store event)))
(ptk/emit! store :the/end))))