I ham-fistedly kill and reset the DB before every test using clojure.test 
fixtures.




Passing the conn never occurred to me, and I kind of wish I did it that way. 
Currently I have any reading database functions accept the db (which makes 
testing using “with” very fast and easy), and any writing functions return the 
tx-data rather than executing it directly. This also makes testing easier, as I 
can assert on the exact tx-data expected, or again use with in my tests to 
check the side-effects. As a result the only tests I have that actually touch 
db state are anything that check my actual routing code.




—

Ashton

On Mon, Oct 27, 2014 at 7:52 AM, Sven Richter <sver...@googlemail.com>
wrote:

> Hi Ashton,
> After some discussion in the datomic and clojure irc channel I decided to 
> go the route to pass in the datomic connection or datomic value to every 
> function. This way it is really easy to do integration tests of these 
> functions by setting up an in memory datomic database for every single one 
> of my tests.
> Mixing in some fixtures and I was done.
> I am curious, how did you solve this finally?
> Best Regards,
> Sven
> Am Montag, 27. Oktober 2014 14:25:12 UTC+1 schrieb Ashton Kemerling:
>>
>> Consider how your database will be setup and handled. My project uses 
>> Datomic (also a SPA), but it was a little painful learning how to get the 
>> tests to run cleanly with the database being setup and torn down between 
>> runs.
>>
>> Also, consider using Secretary on the frontend early. I’m using Om and 
>> thought I could get away without it by using component state to control 
>> what is displayed, and boy was I wrong.
>>
>> —
>> Ashton
>>
>>
>>
>> On Mon, Oct 27, 2014 at 6:54 AM, Joshua Ballanco <jbal...@gmail.com 
>> <javascript:>> wrote:
>>
>>> Just in case you hadn’t already come across it in your Google-ing, I 
>>> thought you should know about http://clojure-doc.org . This site is more 
>>> than just API documentation, it also contains a number of useful guides 
>>> covering various topics in Clojure. It’s not exactly a collection of 
>>> prescriptions, but it might help you figure out what direction to head in 
>>> more than just reading the API docs would.
>>>
>>> Cheers,
>>> Josh
>>>
>>>
>>> On October 27, 2014 at 13:08:42, Colin Yates (colin...@gmail.com 
>>> <javascript:>) wrote:
>>>
>>>   About to embark on a new project and interested in "wish I knew 
>>> this"/"wish I had used this" type sentiments. An extension of this splendid 
>>> article: 
>>> http://blog.mattgauger.com/blog/2014/09/15/clojure-code-quality-tools/. 
>>> Any others?
>>>
>>> For context, this is going to be a non-trivial SPA using clojurescript 
>>> supported by a Clojure backend (
>>> https://groups.google.com/d/topic/clojurescript/9cDFfAGsDE4/discussion)
>>>
>>> In addition to the tips I found in the article I am also planning on 
>>> using core.typed, primarily to address the "anyone remember what this data 
>>> structure looked like?" 12 month maintenance risk. I did look at schematic 
>>> but I like the extra enforcement core.typed gives.
>>>
>>> On a side note, answering this question from google alone is non-trivial. 
>>> We, as a community have reached that point where there are so many (good, 
>>> but overlapping and sometimes contradictory) good next steps it is easy to 
>>> be paralysed by choice. A few more "authorized" (whatever that means) 
>>> "prescriptions" wouldn't go amiss. Not sure what the answer is, merely 
>>> raising the flag. 
>>>
>>> So, what tips/techniques/XYZ do you wish you had started with?
>>>
>>> Thanks!
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com 
>>> <javascript:>
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com <javascript:>
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google Groups 
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to clojure+u...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> <signature.asc>
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to