Fixed all test cases and made change in promise