Fix regression with when/callbacks

Most likely introduced in 3.6.1.  Unit tests were only testing cases where the target function called its callback synchronously.  Added unit tests to cover the async (usual!) case.