Liking cljdoc? Tell your friends :D

cljs-async.test

cljs

Seemless asynchronous testing based on promises for cljs.test.

Seemless asynchronous testing based on promises for cljs.test.
raw docstring

async-fixturecljs

(async-fixture g)

Returns an asynchronous 'map fixture' (see [[cljs.test/use-fixtures]]), defined by a single function g. When the fixture is applied, g will be called with a function f and must return a promise. That promise can start with the required initializations, then must eventually call f and can bind cleanup code to the promise returned by f (which never fails).

For example:

(async-fixture
  (fn [f]
    (-> (my-init)
        (then #(f))
        (then #(my-finish)))))

Note that the returned fixture cannot be used more than once; create fresh ones with the same function g instead.

Returns an asynchronous 'map fixture' (see [[cljs.test/use-fixtures]]),
  defined by a single function `g`. When the fixture is applied, `g`
  will be called with a function `f` and must return a promise. That
  promise can start with the required initializations, then must
  eventually call `f` and can bind cleanup code to the promise
  returned by `f` (which never fails).

  For example:

```
(async-fixture
  (fn [f]
    (-> (my-init)
        (then #(f))
        (then #(my-finish)))))
```

  Note that the returned fixture cannot be used more than once; create
  fresh ones with the same function `g` instead.
sourceraw docstring

compose-async-fixturescljs

(compose-async-fixtures f1 f2)

Composes two asynchronous 'map fixtures', creating an asychronous 'map fixture' that combines their behavior.

Composes two asynchronous 'map fixtures', creating an asychronous
'map fixture' that combines their behavior.
sourceraw docstring

deftestcljmacro

(deftest name & body)

Like [[cljs.test/deftest]], but the last expression in body may be a promise which is then waited for. A rejected promise is reported as a test failure. Tests defined by this are always asynchronous tests.

Like [[cljs.test/deftest]], but the last expression in `body` may
be a promise which is then waited for.  A rejected promise is
reported as a test failure. Tests defined by this are always
asynchronous tests.
sourceraw docstring

join-async-fixturescljs

(join-async-fixtures fixtures)

Composes a collection of asynchronous 'map fixtures', in order.

Composes a collection of asynchronous 'map fixtures', in order.
sourceraw docstring

simple-async-fixturecljs

(simple-async-fixture g)

Returns an asynchronous 'map fixture' (see [[cljs.test/use-fixtures]]), defined by a single function g. When the fixture is applied, g will be called with a function done, which must eventually be applied when the setup is complete. The done can be called with a function that does the the tearing down of the fixture later. If such a function is passed it will later be called with a done too, which must be called eventually to complete the fixture.

For example:

(simple-async-fixture
  (fn [init-done]
    (my-async-init
     (fn []
       (init-done (fn [finish-done]
                    (my-async-finish (fn []
                                       (finish-done)))))))))

Note that the returned fixture cannot be used more than once; create fresh ones with the same function g instead.

Returns an asynchronous 'map fixture' (see [[cljs.test/use-fixtures]]),
  defined by a single function `g`. When the fixture is applied, `g`
  will be called with a function `done`, which must eventually be
  applied when the setup is complete. The `done` can be called with a
  function that does the the tearing down of the fixture later. If
  such a function is passed it will later be called with a `done` too,
  which must be called eventually to complete the fixture.

  For example:

```
(simple-async-fixture
  (fn [init-done]
    (my-async-init
     (fn []
       (init-done (fn [finish-done]
                    (my-async-finish (fn []
                                       (finish-done)))))))))
```

  Note that the returned fixture cannot be used more than once; create
  fresh ones with the same function `g` instead.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close