xhr: Wrote tests for xhr.js

- [x] @Aintaer 
- [x] @davestein