wassy
Version:
REST endpoint abstraction library
15 lines (12 loc) • 353 B
JavaScript
module.exports = {
mockMostRecent: (obj = {}) => {
let { body } = obj;
body = (body === undefined) ? {} : body;
const request = jasmine.Ajax.requests.mostRecent();
request.respondWith({
status: obj.status || 200,
responseText: (typeof body === 'string') ? body : JSON.stringify(body),
});
return request;
},
};