updated test cases with spies