Refactored some tests with Sinon spies