refactor async test logic