Skip to content

Instantly share code, notes, and snippets.

@augustl
Created November 27, 2017 22:20
Show Gist options
  • Save augustl/00e62fd50a7651d889b13d2ac80924e0 to your computer and use it in GitHub Desktop.
Save augustl/00e62fd50a7651d889b13d2ac80924e0 to your computer and use it in GitHub Desktop.
(ns huffda.expectations-basics-test
(:require [clojure.test :refer [deftest testing is async]]
[huffda.expectations :as expec]
[cljs.core.async :refer [chan <! >! put! close! alts! timeout promise-chan]])
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
(defmacro async-test [name & form]
`(testing name
(async done
(do ~@form)
(done))))
(deftest expectations-basics
(async-test
"should-work"
(go
(let [[db err] (<! (expec/create-memory-database))]
(<! (expec/add-expectation db {:key "my-expec-1"} 123))
(is (do (not (<! (expec/is-fulfilled db "my-expec-1")))))
(<! (expec/fulfill-expectation db "my-expec-1" true))
(is (do (<! (expec/is-fulfilled db "my-expec-1"))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment