Liking cljdoc? Tell your friends :D

cljest.core


*formatters-set?*clj

source

*inside-is?*cljs

source

*is-body-negated?*cljs

source

after-allclj/smacro

(after-all & body)

Runs body after all tests in the current file.

Runs `body` after all tests in the current file.
sourceraw docstring

after-eachclj/smacro

(after-each & body)

Runs body after each test in the current scope.

Runs `body` after each test in the current scope.
sourceraw docstring

before-allclj/smacro

(before-all & body)

Runs body before all tests in the current file.

Runs `body` before all tests in the current file.
sourceraw docstring

before-eachclj/smacro

(before-each & body)

Runs body before each test in the current scope.

Runs `body` before each test in the current scope.
sourceraw docstring

describeclj/smacro

(describe name & body)

Describes a block of tests. Any before-each/after-each inside of this block will be scoped to it.

Example:

(describe "some-fn"
  (before-each (do-something))
  (after-each (cleanup))

  (it "does something" ...))
Describes a block of tests. Any `before-each`/`after-each` inside of this block will be scoped to it.

Example:

```
(describe "some-fn"
  (before-each (do-something))
  (after-each (cleanup))

  (it "does something" ...))
```
sourceraw docstring

eachclj/smacro

(each seq-exprs name & body)

A nicer way to create the same test case for multiple inputs. Essentially doseq for test cases, except the second argument is the description passed into the generated it block.

Example:

(each [[text num] ["hello" 1]
                  ["world" 2]
                  ["foo" 3]]
  (str "should call the function with " text " and " num)
  (do-something-with text num))

Above generates:

(it "should call the function with hello and 1" (do-something-with "hello" 1))
(it "should call the function with world and 2" (do-something-with "world" 2))
(it "should call the function with foo and 3" (do-something-with "foo" 3))
A nicer way to create the same test case for multiple inputs. Essentially `doseq` for
test cases, except the second argument is the description passed into the generated `it`
block.

Example:

```
(each [[text num] ["hello" 1]
                  ["world" 2]
                  ["foo" 3]]
  (str "should call the function with " text " and " num)
  (do-something-with text num))
```

Above generates:

```
(it "should call the function with hello and 1" (do-something-with "hello" 1))
(it "should call the function with world and 2" (do-something-with "world" 2))
(it "should call the function with foo and 3" (do-something-with "foo" 3))
```
sourceraw docstring

isclj/smacro

(is form)

A generic assertion macro for Jest. Asserts that form is truthy.

Note: This does not work exactly like clojure.test/is. It does not accept thrown? or thrown-with-msg?.

Example:

(it "should be true" (is (= true (my-fn :some-keyword)))

A generic assertion macro for Jest. Asserts that `form` is truthy.

Note: This does not work exactly like `clojure.test/is`. It does not accept `thrown?` or `thrown-with-msg?`.

Example:

(it "should be true"
  (is (= true (my-fn :some-keyword)))
sourceraw docstring

itclj/smacro

(it name & body)

A single test case.

A single test case.
sourceraw docstring

onlyclj/smacro

(only name & body)

Like it but is the only test that runs in this file.

Like `it` but is the only test that runs in this file.
sourceraw docstring

only-eachclj/smacro

(only-each seq-exprs name & body)

A combination of each and only.

A combination of `each` and `only`.
sourceraw docstring

skipclj/smacro

(skip name & body)

Like it, but skips the test. Can be used to temporarily skip flaky tests.

Like `it`, but skips the test. Can be used to temporarily skip flaky tests.
sourceraw docstring

spycljs

(spy)
(spy mock-implementation)

An unused spy, optionally taking mock-implementation, a function that will be called when this spy is called.

An unused spy, optionally taking `mock-implementation`, a function that will be called
when this spy is called.
sourceraw docstring

spy-oncljs

(spy-on object method-name)
(spy-on object method-name access-type)

Creates a mock function similar to jest.fn but also tracks calls to (.-method-name object).

Essentially it overrides a specific property on an object while preserving the original function.

See https://jestjs.io/docs/jest-object#jestspyonobject-methodname for more details.

Creates a mock function similar to jest.fn but also tracks calls to (.-method-name object).

Essentially it overrides a specific property on an object while preserving the original
function.

See https://jestjs.io/docs/jest-object#jestspyonobject-methodname for more details.
sourceraw docstring

todoclj/smacro

(todo name)

Similar to a semi TODO, allows writing the name of a test case before writing the actual case.

Similar to a semi TODO, allows writing the name of a test case before writing the actual case.
sourceraw docstring

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

× close