🐛 Fix token file import of Figma generated file (#5591)

* 🐛 Fix token sets selection representation in exported theme

* 🐛 Fix the loss of token set order

* 🐛 Change data shape according to internal representaion

* 🐛 Persist sets order on import according to metadata

* 🐛 Add fallback for nil values

* 🐛 Fix test assertions accoding to the exported json format

* 🐛 Make `:is-source` optional

* ♻️ Fix test description

* ♻️ Remove outdated comment
This commit is contained in:
Andrei Fëdorov 2025-01-16 12:38:03 +01:00 committed by GitHub
parent cf82e42125
commit 5793c526c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 27 deletions

View file

@ -32,9 +32,10 @@
(t/deftest process-json-stream-test
(t/async
done
(t/testing "processes empty json string"
(t/testing "process simple color token value"
(let [json (-> {"core" {"color" {"$value" "red"
"$type" "color"}}}
"$type" "color"}}
"$metadata" {"tokenSetOrder" ["core"]}}
(tr/encode-str {:type :json-verbose}))]
(->> (rx/of json)
(sd/process-json-stream)
@ -103,7 +104,8 @@ color.value tries to reference missing, which is not defined.")))
done
(t/testing "fails on missing references in tokens"
(let [json (-> {"core" {"color" {"$value" "{missing}"
"$type" "color"}}}
"$type" "color"}}
"$metadata" {"tokenSetOrder" ["core"]}}
(tr/encode-str {:type :json-verbose}))]
(->> (rx/of json)
(sd/process-json-stream)