Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('behaviour', () => {
const CALL_API = require('redux-api-middleware').CALL_API;
const reduxFetcher = require('../src');
describe('createFetchAction', () => {
let validAction, validCamelAction;
beforeEach(() => {
validAction = reduxFetcher.createFetchAction('data', 'http://localhost/api')[CALL_API];
validCamelAction = reduxFetcher.createFetchAction('dataCamelCase', 'http://localhost/api')[CALL_API];
});
afterEach(() => {
validAction = null;
});
it('must throw if identifier is not provided', () => {
(() => reduxFetcher.createFetchAction()).should.throw(Error);
if (headers["Content-Type"] === "multipart/form-data") {
delete headers["Content-Type"];
delete headers["content-type"];
}
//
var result = {
endpoint: getState().api.protocol + "://" + getState().api.host + getState().api.basePath + realPath,
method: method,
headers: headers,
body: body,
types: (0, _api.processType)(types, pathName, method)
};
return dispatch((0, _defineProperty3.default)({}, _reduxApiMiddleware.CALL_API, result));
};
}
}
if (headers["Content-Type"] === "multipart/form-data") {
delete headers["Content-Type"];
delete headers["content-type"];
}
//
var result = {
endpoint: getState().api.protocol + "://" + getState().api.host + getState().api.basePath + realPath,
method: method,
headers: headers,
body: body,
types: (0, _api.processType)(types, pathName, method)
};
return (0, _defineProperty3.default)({}, _reduxApiMiddleware.CALL_API, result);
}