refactor tests by using Future