Adjusted unit test to handle async and recursion.