I have a µtest suite that needs to check that some asynchronous operation eventually has a side effect. Since javascript (and thus scala.js) is single threadded, it is not possible to block and wait for the side effect to happen. Also, the µtest eventually method does not work on javascript runtime. How do I perform such a test?
How do I test scala.js programs for side-effects that happen asynchronously using µtest?
209 views Asked by Julie At
        	1
        	
        
	
                        
If you return a
Futurefrom a µtest, then the test will pass if the future succeeds and fail if the future fails. Thus, you can schedule the conditional check for some point in the future without blocking.I wrote a simple
eventuallymethod that accomplishes this:Here is an example of usage: