Fork me on GitHub
#testing
<
2020-05-20
>
plexus17:05:29

(defmacro will
  "Variant of [[clojure.test/is]] that gives the predicate a bit of time to become
  true."
  [expected]
  `(loop [i# 0]
     (if (and (not ~expected) (< i# 10))
       (do
         (Thread/sleep 10)
         (recur (inc i#)))
       (t/is ~expected))))

plexus17:05:52

(will (= [{:whoami {:id :abc :hello :world}}] (vals @state)))

plexus17:05:24

fun little helper for eventually consistent tests