Refactor sinon stubs