xhr: Wrote tests for xhr.js

- [x] @Aintaer 
- [x] @davestein
@Aintaer you checked your box and i checked mine, do you want indenting fixe before i hit merge?