From e75f9a7c7fe638183c8002ac993eda187c249b67 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 8 Jul 2024 11:06:57 +0200 Subject: [PATCH] Add predicate for all test --- frontend/src/app/main/ui/workspace/tokens/token.cljs | 5 +++++ frontend/test/token_tests/token_test.cljs | 1 + 2 files changed, 6 insertions(+) diff --git a/frontend/src/app/main/ui/workspace/tokens/token.cljs b/frontend/src/app/main/ui/workspace/tokens/token.cljs index 66f251db0..74df395c0 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token.cljs @@ -59,6 +59,11 @@ acc applied-attrs)))) {} shapes)) +(defn group-shapes-by-all-applied-all? [grouped-shapes] + (and (seq (:all grouped-shapes)) + (empty? (:other grouped-shapes)) + (empty? (:some grouped-shapes)))) + (defn token-name->path "Splits token-name into a path vector split by `.` characters. diff --git a/frontend/test/token_tests/token_test.cljs b/frontend/test/token_tests/token_test.cljs index 9b0462955..dcf0b69ef 100644 --- a/frontend/test/token_tests/token_test.cljs +++ b/frontend/test/token_tests/token_test.cljs @@ -34,6 +34,7 @@ (let [shapes [{:applied-tokens {:x 1 :y 1}} {:applied-tokens {:x 1 :y 1}}] expected (wtt/group-shapes-by-all-applied {:id 1} shapes #{:x :y})] + (t/is (true? (wtt/group-shapes-by-all-applied-all? expected))) (t/is (= (:all expected) shapes)) (t/is (empty? (:other expected))) (t/is (empty? (:some expected)))))