metabase / metabase/hawk

Support comparing native JS objects in CLJS

Open
#24 0 comments 0 reactions 1 assignee Claimed by @bshepherdson View on GitHub
Dominant language
Clojure
Stars
60
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Two JS objects or arrays with `=?` contents should be `=?`.

Deep comparison on JS objects is intractable, but we can support the obvious cases of vanilla objects and arrays. If the constructor on either side is something else (like a custom class) then it can be always `false`.

```clojure
;; I want to write this.
(deftest slick-test
(is (=? #js {:abc 7, :xyz {:some "Clojure map"}}
(a-function 7))))

;; Instead I have to write this.
(deftest clunky-test
(let [js-blob (a-function 7)]
(is (=? 7 (.-abc js-blob)))
(is (=? {:some "Clojure map"} (.-xyz js-blob)))))
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.