mirror of
https://github.com/penpot/penpot.git
synced 2026-03-31 00:29:37 +02:00
* 🐛 Fix TypeError when token error map lacks :error/fn key Guard against missing :error/fn in token form control resolve streams. When schema validation errors are produced they may not carry an :error/fn key; calling nil as a function caused a TypeError crash. Apply an if-let guard at all 7 affected sites across input.cljs, color_input.cljs and fonts_combobox.cljs, falling back to :message or returning the error map unchanged. * ♻️ Extract token error helpers and add unit tests Extract resolve-error-message and resolve-error-assoc-message helpers into errors.cljs, replacing the seven duplicated inline lambdas in input.cljs, color_input.cljs and fonts_combobox.cljs with named function references. Add frontend-tests.tokens.token-errors-test covering both helpers for the normal path (:error/fn present) and the fallback path (schema-validation errors that lack :error/fn). Signed-off-by: Penpot Dev <dev@penpot.app> --------- Signed-off-by: Penpot Dev <dev@penpot.app>
59 lines
2.2 KiB
Clojure
59 lines
2.2 KiB
Clojure
(ns frontend-tests.runner
|
|
(:require
|
|
[cljs.test :as t]
|
|
[frontend-tests.basic-shapes-test]
|
|
[frontend-tests.data.workspace-colors-test]
|
|
[frontend-tests.helpers-shapes-test]
|
|
[frontend-tests.logic.comp-remove-swap-slots-test]
|
|
[frontend-tests.logic.components-and-tokens]
|
|
[frontend-tests.logic.copying-and-duplicating-test]
|
|
[frontend-tests.logic.frame-guides-test]
|
|
[frontend-tests.logic.groups-test]
|
|
[frontend-tests.logic.pasting-in-containers-test]
|
|
[frontend-tests.plugins.context-shapes-test]
|
|
[frontend-tests.svg-fills-test]
|
|
[frontend-tests.tokens.import-export-test]
|
|
[frontend-tests.tokens.logic.token-actions-test]
|
|
[frontend-tests.tokens.logic.token-data-test]
|
|
[frontend-tests.tokens.logic.token-remapping-test]
|
|
[frontend-tests.tokens.style-dictionary-test]
|
|
[frontend-tests.tokens.token-errors-test]
|
|
[frontend-tests.tokens.workspace-tokens-remap-test]
|
|
[frontend-tests.util-object-test]
|
|
[frontend-tests.util-range-tree-test]
|
|
[frontend-tests.util-simple-math-test]
|
|
[frontend-tests.worker-snap-test]))
|
|
|
|
(enable-console-print!)
|
|
|
|
(defmethod cljs.test/report [:cljs.test/default :end-run-tests] [m]
|
|
(if (cljs.test/successful? m)
|
|
(.exit js/process 0)
|
|
(.exit js/process 1)))
|
|
|
|
(defn init
|
|
[]
|
|
(t/run-tests
|
|
'frontend-tests.basic-shapes-test
|
|
'frontend-tests.data.workspace-colors-test
|
|
'frontend-tests.helpers-shapes-test
|
|
'frontend-tests.logic.comp-remove-swap-slots-test
|
|
'frontend-tests.logic.components-and-tokens
|
|
'frontend-tests.logic.copying-and-duplicating-test
|
|
'frontend-tests.logic.frame-guides-test
|
|
'frontend-tests.logic.groups-test
|
|
'frontend-tests.logic.pasting-in-containers-test
|
|
'frontend-tests.plugins.context-shapes-test
|
|
'frontend-tests.svg-fills-test
|
|
'frontend-tests.tokens.import-export-test
|
|
'frontend-tests.tokens.logic.token-actions-test
|
|
'frontend-tests.tokens.logic.token-data-test
|
|
'frontend-tests.tokens.logic.token-remapping-test
|
|
'frontend-tests.tokens.style-dictionary-test
|
|
'frontend-tests.tokens.token-errors-test
|
|
'frontend-tests.util-object-test
|
|
'frontend-tests.util-range-tree-test
|
|
'frontend-tests.util-simple-math-test
|
|
'frontend-tests.tokens.workspace-tokens-remap-test
|
|
'frontend-tests.worker-snap-test))
|