Write less on mocking xhr