mobx-rest-jquery-adapter
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -238,7 +238,8 @@ import adapter from '../src' | ||
describe('del', () => { | ||
describe('patch', () => { | ||
let ret | ||
const data = { name: 'paco' } | ||
const action = () => { | ||
ret = adapter.del('/users') | ||
ret = adapter.patch('/users', data) | ||
} | ||
@@ -261,2 +262,50 @@ | ||
expect(jq.ajax.mock.calls[0][1]).toEqual({ | ||
method: 'PATCH', | ||
contentType: 'application/json', | ||
headers: { 'SomeHeader': 'test' }, | ||
xhrFields: { withCredentials: true }, | ||
data: '{"name":"paco"}' | ||
}) | ||
}) | ||
}) | ||
}) | ||
describe('when it fails', () => { | ||
const values = '{"errors": ["foo"]}' | ||
beforeEach(() => { | ||
injectFail(values) | ||
action() | ||
}) | ||
it('sends a xhr request with data parameters', () => { | ||
expect(ret.abort).toBeTruthy() | ||
return ret.promise.catch((vals) => { | ||
expect(vals).toEqual(['foo']) | ||
}) | ||
}) | ||
}) | ||
}) | ||
describe('del', () => { | ||
let ret | ||
const action = () => { ret = adapter.del('/users', { foo: 'bar' }) } | ||
describe('when it resolves', () => { | ||
const values = { id: 1, name: 'paco' } | ||
beforeEach(() => { | ||
injectDone(values) | ||
action() | ||
}) | ||
it('sends a xhr request with data parameters', () => { | ||
expect(ret.abort).toBeTruthy() | ||
return ret.promise.then((vals) => { | ||
expect(vals).toEqual(values) | ||
expect(jq.ajax.mock.calls[0][0]).toBe('/api/users') | ||
expect(jq.ajax.mock.calls[0][1]).toEqual({ | ||
method: 'DELETE', | ||
@@ -266,3 +315,3 @@ contentType: 'application/json', | ||
xhrFields: { withCredentials: true }, | ||
data: null | ||
data: '{"foo":"bar"}' | ||
}) | ||
@@ -269,0 +318,0 @@ }) |
@@ -118,7 +118,12 @@ 'use strict'; | ||
}, | ||
del: function del(path) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
patch: function patch(path, data) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
return ajax('' + this.apiPath + path, (0, _lodash.merge)({}, { method: 'DELETE' }, this.commonOptions, options)); | ||
return ajax('' + this.apiPath + path, (0, _lodash.merge)({}, { method: 'PATCH', data: data }, this.commonOptions, options)); | ||
}, | ||
del: function del(path, data) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
return ajax('' + this.apiPath + path, (0, _lodash.merge)({}, { method: 'DELETE', data: data }, this.commonOptions, options)); | ||
} | ||
}; |
{ | ||
"name": "mobx-rest-jquery-adapter", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "jQuery adapter for mobx-rest", | ||
@@ -27,19 +27,19 @@ "repository": { | ||
"dependencies": { | ||
"jquery": "^3.4.0", | ||
"lodash": "^4.17.4" | ||
"jquery": "3.4.0", | ||
"lodash": "4.17.4" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.10.1", | ||
"babel-core": "^6.10.4", | ||
"babel-eslint": "^7.1.1", | ||
"babel-jest": "^18.0.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.8.0", | ||
"babel-polyfill": "^6.9.1", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"babel-register": "^6.9.0", | ||
"flow-bin": "^0.38.0", | ||
"jest": "^18.1.0", | ||
"snazzy": "^6.0.0", | ||
"standard": "^8.6.0" | ||
"babel-cli": "6.10.1", | ||
"babel-core": "6.10.4", | ||
"babel-eslint": "7.1.1", | ||
"babel-jest": "18.0.0", | ||
"babel-plugin-transform-flow-strip-types": "6.8.0", | ||
"babel-polyfill": "6.9.1", | ||
"babel-preset-es2015": "6.3.13", | ||
"babel-preset-stage-1": "6.5.0", | ||
"babel-register": "6.9.0", | ||
"flow-bin": "0.38.0", | ||
"jest": "18.1.0", | ||
"snazzy": "6.0.0", | ||
"standard": "8.6.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "main": "lib", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
380647
12
7383
1
+ Addedjquery@3.4.0(transitive)
+ Addedlodash@4.17.4(transitive)
- Removedjquery@3.7.1(transitive)
- Removedlodash@4.17.21(transitive)
Updatedjquery@3.4.0
Updatedlodash@4.17.4