Create state transformation for async while + unit test for it