I think you dont need this logic for the tests. I've just remove this and try again, and all tests were passed! Could you take a look?