mirror of
https://github.com/penpot/penpot.git
synced 2026-11-05 01:20:38 +00:00
🐛 Count id and type in the wasm shape proxy (#12793)
The proxy counted one entry fewer than it yields, so it was never equal to a plain map with the same entries. Count both fields and test it.
This commit is contained in:
parent
2573908315
commit
8d7e275b6b
@ -77,7 +77,7 @@
|
||||
|
||||
c/ICounted
|
||||
(-count [_]
|
||||
(+ 1 (count delegate)))
|
||||
(+ 2 (count delegate)))
|
||||
|
||||
c/IKVReduce
|
||||
(-kv-reduce [_ f init]
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns frontend-tests.render-wasm.shape-proxy-test
|
||||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.render-wasm.shape :as wasm.shape]
|
||||
[cljs.test :as t :include-macros true]))
|
||||
|
||||
(def ^:private attrs
|
||||
{:id (uuid/next) :type :rect :name "Rect" :x 10 :y 20})
|
||||
|
||||
(t/deftest count-includes-id-and-type
|
||||
(let [shape (wasm.shape/create-shape attrs)]
|
||||
(t/is (= (count attrs) (count shape)))
|
||||
(t/is (= (count shape) (count (seq shape))))))
|
||||
|
||||
(t/deftest equals-plain-map-with-same-entries
|
||||
(let [shape (wasm.shape/create-shape attrs)]
|
||||
(t/is (= shape attrs))
|
||||
(t/is (= attrs shape))))
|
||||
@ -94,6 +94,7 @@
|
||||
[frontend-tests.render-dimensions-test]
|
||||
[frontend-tests.render-wasm.process-objects-test]
|
||||
[frontend-tests.render-wasm.serialization-test]
|
||||
[frontend-tests.render-wasm.shape-proxy-test]
|
||||
[frontend-tests.render-wasm.text-editor-apply-styles-test]
|
||||
[frontend-tests.render-wasm.text-editor-caret-color-test]
|
||||
[frontend-tests.render-wasm.text-editor-content-range-test]
|
||||
@ -273,6 +274,7 @@
|
||||
'frontend-tests.plugins.value-objects-test
|
||||
'frontend-tests.render-wasm.process-objects-test
|
||||
'frontend-tests.render-wasm.serialization-test
|
||||
'frontend-tests.render-wasm.shape-proxy-test
|
||||
'frontend-tests.render-wasm.text-editor-apply-styles-test
|
||||
'frontend-tests.render-wasm.text-editor-caret-color-test
|
||||
'frontend-tests.render-wasm.text-editor-content-range-test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user