Last active
December 14, 2015 17:49
-
-
Save tcrayford/5125398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; fails | |
(defn calls-callback [callback] | |
(fn [thing] (callback thing))) | |
(defn callback [a] (print a)) | |
(fact "calls-callback can be mocked to check the callback is called" | |
(let [closed (calls-callback callback)] | |
(closed 1) => anything | |
(provided (callback 1) => ...ignored... :times 1))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; fails | |
(defn calls-callback [callback] | |
(fn [thing] (callback thing))) | |
(fact "calls-callback can be mocked to check the callback is called" | |
(let [closed (calls-callback ...callback...)] | |
(closed 1) => anything | |
(provided (...callback... 1) => ...ignored... :times 1))) | |
; passes | |
(fact "calls-callback can be mocked to check the callback is called" | |
((calls-callback ...callback...) 1) => anything | |
(provided (...callback... 1) => ...ignored... :times 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment