Skip to content

mhjort/clj-async-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-async-test

clojure.test assertions for testing asynchronous code

Installation

Add the following to your project.clj :dependencies:

[clj-async-test "0.0.5"]

Usage

Following test pass immediately if predicate '(= actual expected) is true. Otherwise test runner tries it multiple times and fails if it does not pass in one second.

(require '[clj-async-test :refer :all])

(is (eventually (= actual expected)))

Sometimes when testing asynchronous code it is hard to test with exact numbers. It's enough when something is approximately right. Following test pass if difference between actual and expected is less than 1%.

(require '[clj-async-test :refer :all])

(is (approximately== actual expected))

You can also set the desired accuracy.

(is (approximately== actual expected :accuracy 5))

License

Copyright (C) 2015-2016 Markus Hjort

Distributed under the Eclipse Public License, the same as Clojure.

About

clojure.test assertions for testing asynchronous code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published