This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-08
Channels
- # admin-announcements (3)
- # alda (2)
- # beginners (66)
- # boot (54)
- # cider (21)
- # clara (1)
- # cljsfiddle (32)
- # cljsrn (9)
- # clojars (4)
- # clojure (164)
- # clojure-dusseldorf (4)
- # clojure-japan (2)
- # clojure-norway (1)
- # clojure-russia (76)
- # clojure-sg (8)
- # clojurescript (19)
- # core-async (1)
- # core-typed (1)
- # cursive (6)
- # datomic (1)
- # editors (48)
- # hoplon (20)
- # immutant (2)
- # jobs-discuss (6)
- # ldnclj (1)
- # om (82)
- # onyx (6)
- # parinfer (11)
- # proton (2)
- # re-frame (113)
- # reagent (17)
- # testing (11)
- # untangled (11)
- # vim (4)
- # yada (38)
@bjr You could try:
1) Mark your deftests with metadata to define the groups... e.g. (deftest ^:functional functional-test ...)
2) In your fixture test that the function has the appropriate metadata. The difficulty is that the metadata exists on the deftest vars not on the functions - and the fixtures receive the functions themselves... So you'll have to look in the ns-map deref all the vars to find the functions and then build a new map from fn => (meta var)
3) then lookup your function in the map to access its meta data and compare the key.
4) If the key on the functions var is =
to the key associated with the fixture - execute the fixture - otherwise just call the function.
Anyone have experience testing ajax calls with cljs.test? Looking for an example to peruse.
@gadfly361: are you going to do the actual requests, or are you thinking about mocking them? In any case you are probably going to use cljs.test/async
, did you see it?
for the most part, ill be mocking the response from requests. Curious how to do an actual request in a test tho, just to know how. I saw async
, and assume that's the secret sauce, but it didn't appear to run the ajax call. I did something along the lines of:
(deftest fake-test
(async done
(some-ajax-call)
(done))
(is (= ... )))