xhr: Wrote tests for xhr.js

- [ ] @davestein
All the way down you are using same `type` `url` `data`. You should declare them up above as variables. That way, if for whatever reason we need to make a change, you only have to do it one spot.

On a related note, if you were only using them in one function, you'd still want to save them off. That way changing the value changes the expects without having to change it in two places.