Fork me on GitHub

@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
  (is (= ... )))


the thing is that you should call done only after all your assertions have run... and that's upon the request response usually... so if your ajax call accepts a callback, then you will usually have the assertions in the callback, and then you'll call done, still in the callback


if it returns a core.async chan, you'd have a go block, etc...


ahh that makes sense, thank you!


don't worry


about mocking, try to avoid it in async tests as most as possible simple_smile


sounds good, thanks simple_smile Need to do a little bit of refactoring and try this out