Testing in ClojureScript
In Clojure, we used the clojure.test
library for testing. In ClojureScript, we have a port of clojure.test
in the form of cljs.test
. In cljs.test
, we have functionality that we used when we wrote tests using the clojure.test
library. We can use the is
and are
macros to write our tests. cljs.test
provides facilities for asynchronous testing. Asynchronous testing is a type of testing that tests asynchronous code. We will see shortly why it is important that cljs.test
allows us to test asynchronous code.
Synchronous code is what developers write most of the time, even without realizing this. In synchronous code, code is executed line by line. For example, the code defined in line 10 needs to finish executing before the code on line 11 can start executing. This is step-by-step execution. Asynchronous coding is a more advanced concept.
In asynchronous programming, executing code and completing the execution of code cannot happen in a line-by-line fashion...