Testing Without Mocks Example in Clojure

This is an example of James Shore's Testing Without Mocks approach in Clojure.

Functional example

The original example is heavily based on Object-Oriented Programming, it constructs objects and then calls methods on them. That is not very idiomatic in Clojure. Many APIs for interacting with side-effectful resources are just calling impure functions without any object construction.

To experiment with Functional Programming approach I created a different example in the functional-example directory.

Original example

This repo started with re-implementation of the original example.

Manual dependency injection:

Also experimented with some Clojure DI frameworks:

Run the command line program (in a given subfolder):

$ cd testing-without-mocks
$ clojure -M:run "Hello World"
Uryyb Jbeyq

Run tests with:

$ clojure -M:test

ClojureScript version

Run the command line program:

$ clojure -Mshadow compile main && node out/main.js "Hello World"
Uryyb Jbeyq

Run tests with:

$ clojure -Mshadow compile test && node out/node-tests.js