post: function(url, fn) {
return this.mock('POST', url, fn);
}
this string is compared to the method sent from the code being tested, if your code sends lower case it will fail, (not sure if you want to str.toUpperCase() or just let it fail)
Obviously I think it's best practice to always capitalise http methods but this was a slip up which was not obvious (since the code worked but the test failed)
I just made a silly error which took me all morning to find.
Browsers handle GET and POST case-insensitively but XHR-mock does not. https://stackoverflow.com/questions/7790576/what-are-http-method-capitalization-best-practices
-- in line 90 of index.js for xhr-mock
post: function(url, fn) { return this.mock('POST', url, fn); } this string is compared to the method sent from the code being tested, if your code sends lower case it will fail, (not sure if you want to str.toUpperCase() or just let it fail)
Obviously I think it's best practice to always capitalise http methods but this was a slip up which was not obvious (since the code worked but the test failed)
Hope it's useful to someone.
James