Asynchronous Testing with Jasmine
Creating async tests with jasmine is quite intuitive.
If you've read the documentation, then you are aware of the waitsFor
and runs
helpers in Jasmine.
I had more than one async action in my test, so it required an inspection on my side to verify that Jasmine would run the test in the same way I had expected.
If you specify a series of waitsFor
or waits
and runs
callbacks, then Jasmine will start the countdown for each waitsFor
at the appropriate time (in this gist - after the previous runs
callback was completed).
This gist shows a successful test that performs 2 async increments of x
. The values of the countdowns indicate that the callbacks are called at the appropriate time, otherwise the test will fail at the second waitsFor
.