Skip to content

Commit

Permalink
Don't url-encode type/id when calling deleteRecord mutation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrichar1 committed Mar 13, 2023
1 parent 62fd2ea commit 9aaeb0b
Show file tree
Hide file tree
Showing 5 changed files with 2,407 additions and 3,161 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Test Suite
run: |
Expand Down
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonapi-vuex",
"version": "5.10.0",
"version": "5.11.0",
"description": "Access restructured JSONAPI data from a Vuex Store.",
"author": "Matthew Richardson <[email protected]>",
"scripts": {
Expand All @@ -17,59 +17,59 @@
"src/"
],
"dependencies": {
"jsonpath-plus": "^6.0.1",
"jsonpath-plus": "^7.2.0",
"lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.2",
"lodash.set": "^4.3.2"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-e2e-nightwatch": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/test-utils": "^1.2.2",
"axios": "^0.21.1",
"axios-mock-adapter": "^1.19.0",
"@vue/test-utils": "^2.3.1",
"axios": "^1.3.4",
"axios-mock-adapter": "^1.21.2",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-istanbul": "^6.0.0",
"babel-loader": "^9.1.2",
"babel-plugin-istanbul": "^6.1.1",
"babel-polyfill": "^6.26.0",
"chai": "^4.3.4",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chromedriver": "^106",
"concurrently": "^6.2.1",
"core-js": "^3.16.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"chromedriver": "^110.0.0",
"concurrently": "^7.6.0",
"core-js": "^3.29.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier-vue": "^3.1.0",
"eslint-plugin-vue": "^7.16.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier-vue": "^4.2.0",
"eslint-plugin-vue": "^9.9.0",
"fake-json-api-server": "^1.6.0",
"geckodriver": "^3.0.1",
"husky": "^7.0.1",
"jsdoc": "^3.6.6",
"karma": "^6.3.4",
"geckodriver": "^3.2.0",
"husky": "^8.0.3",
"jsdoc": "^4.0.2",
"karma": "^6.4.1",
"karma-chai": "^0.1.0",
"karma-coverage": "^2.0.3",
"karma-firefox-launcher": "^2.1.1",
"karma-coverage": "^2.2.0",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-sinon": "^1.0.5",
"karma-verbose-reporter": "^0.0.6",
"karma-verbose-reporter": "^0.0.8",
"karma-webpack": "^5.0.0",
"lint-staged": "^11.1.2",
"mocha": "^9.0.3",
"lint-staged": "^13.2.0",
"mocha": "^10.2.0",
"mocha-eslint": "^7.0.0",
"nightwatch": "^2.3.0",
"prettier": "^2.3.2",
"sinon": "^14.0.0",
"nightwatch": "^2.6.17",
"prettier": "^2.8.4",
"sinon": "^15.0.2",
"sinon-chai": "^3.7.0",
"vue": "^3.2.37",
"vuex": "^4.0.0"
"vue": "^3.2.47",
"vuex": "^4.1.0"
},
"peerDependencies": {
"vue": "^3.0.11",
Expand Down
2 changes: 1 addition & 1 deletion src/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default () => {
* @param {(string|object)} record - The record to be deleted
*/
deleteRecord: (state, record) => {
const [type, id] = utils.getTypeId(record)
const [type, id] = utils.getTypeId(record, false)
if (!type || !id) {
throw `deleteRecord: Missing type or id: ${record}`
}
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/jsonapi-vuex.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ describe('jsonapi-vuex tests', function () {
deleteRecord(storeWidget1, 'widget/1')
expect(storeWidget1[normWidget1['_jv']['type']]).to.not.have.key(normWidget1['_jv']['id'])
})
it('should delete a record (string) from the store without url-encoding it', function () {
const { deleteRecord } = jm.mutations
let storeCompound1 = {
widget: {
'hello:world': { _jv: { type: 'widget', id: 'hello:world' } },
},
}
deleteRecord(storeCompound1, 'widget/hello:world')
expect(storeCompound1['widget']).to.not.have.key('hello:world')
})
it('should throw an error if no type or id present.', function () {
const { deleteRecord } = jm.mutations
// expect needs a function to call, not the return from a function
Expand Down
Loading

0 comments on commit 9aaeb0b

Please sign in to comment.