Quickstart

1) I assume your Clojure/ClojureScript project is automated using Leiningen and already has unit tests implemented with some unit testing framework.

I will use a built-in clojure.test/cljs.test framework in this documentation. To learn how to use it:

2) Add framework dependency into project.clj (the framework is hosted on Clojars):

:dependencies [...
               [clj-fakes "0.12.0"]]

3) Require framework namespace in your unit test source file:

(ns unit.example
  (:require
    [clojure.test :refer [is deftest]]
    [clj-fakes.core :as f]))

4) Now you can write a simple unit test which creates and calls a fake function:

(deftest fakes-work
  (f/with-fakes
    (let [hello (f/fake [[] "hello, world"])]
      (is (= "hello, world" (hello))))))