xhr: Wrote tests for xhr.js

- [ ] @Aintaer 
- [ ] @davestein
Why are all of these strangely indented?