From 46ba8de5f9f9c7f9ed6dcc1213e7d4bd60906f9a Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 9 Jun 2020 09:33:51 -0400 Subject: [PATCH 1/5] Updating merge to 9 alpha --- LICENSE | 34 +++++++++++++++++----------------- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/LICENSE b/LICENSE index 85a9fd3f..563b92b9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,28 +1,28 @@ -Copyright 2019 Ian Walter +Copyright Ian Walter (https://ianwalter.dev) -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -* The above copyright notice and this permission notice shall be included in all +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -* The software may not be used by individuals, corporations, governments, or - other groups for systems or activities that actively and knowingly endanger, - harm, or otherwise threaten the physical, mental, economic, or general +* The software may not be used by individuals, corporations, governments, or + other groups for systems or activities that actively and knowingly endanger, + harm, or otherwise threaten the physical, mental, economic, or general well-being of individuals or groups in violation of the United Nations - Universal Declaration of Human Rights + Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/). -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -This license is derived from the MIT License, as amended to limit the impact of +This license is derived from the MIT License, as amended to limit the impact of the unethical use of open source software. diff --git a/package.json b/package.json index f2176664..8e6d1aa8 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ ], "dependencies": { "@ianwalter/clone": "^6.0.1", - "@ianwalter/merge": "^7.0.0" + "@ianwalter/merge": "^9.0.0-0" }, "devDependencies": { "@fullhuman/purgecss-loader": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index f5794564..b54d21a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -516,10 +516,10 @@ resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-6.0.0.tgz#7d7facccc86fb407571c78de00a0bd2adca395cb" integrity sha512-Ohskh/vqQFgW2Abaxd3kPYz/uNqoUmCSjU8kB8SoRieQqIOyXit1pFKYW4HmcoRcDFbktpWmS1QpIBoF74DGBg== -"@ianwalter/merge@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-7.0.0.tgz#2fc97113eea21c1fd25132c8ddb93d3f20a83d04" - integrity sha512-PuJJiUQZSNRu6zrC6xrJx9/gX0NX9rilQ646+VBSj+X7RRBUWOogqxEUHojOJcwYTt2JzWVV9DIvvsZMkfZP5Q== +"@ianwalter/merge@^9.0.0-0": + version "9.0.0-0" + resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-9.0.0-0.tgz#318e47a86a741e84d872be37377865df96847879" + integrity sha512-pllC0tdkj7Cx/+d4hLE3nqtForGzDcQg3/0LpuHeroErjzV0DYG9MJcBLUkQ3zV7omrCx5T/EIFv4FosTBGdBQ== "@ianwalter/npm-short-name@^1.0.0": version "1.0.0" From 1eb61c503a8c9dfe5aa3802496aff64be162fdb8 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 9 Jun 2020 09:54:37 -0400 Subject: [PATCH 2/5] Adding #366 --- tests.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests.js b/tests.js index 4875d07d..e689dd57 100644 --- a/tests.js +++ b/tests.js @@ -2,26 +2,32 @@ const { test } = require('@ianwalter/bff') const Vue = require('vue') const Vuex = require('vuex') const clone = require('@ianwalter/clone') +const merge = require('@ianwalter/merge') const VuexReset = require('.') Vue.use(Vuex) -test('state is reset when trigger mutation executed', ctx => { - const state = { message: 'Hello!' } +test('state is reset when trigger mutation executed', t => { + const state = { message: 'Hello!', with: { my: { e: 'yes', open: true } } } const store = new Vuex.Store({ plugins: [VuexReset()], state: clone(state), mutations: { message: (state, message) => (state.message = message), + data: (state, data) => merge(state, data), reset: () => {} } }) store.commit('message', 'Greetings!') store.commit('reset') - ctx.expect(store.state).toEqual(state) + t.expect(store.state).toEqual(state) store.commit('message', 'Yo!') store.commit('reset') - ctx.expect(store.state).toEqual(state) + t.expect(store.state).toEqual(state) + store.commit('data', { with: { my: { open: false } } }) + t.expect(store.state.with).toEqual({ my: { e: 'yes', open: false } }) + store.commit('reset') + t.expect(store.state).toEqual(state) }) test('only module state is reset when module mutation executed', ctx => { From b366a78d9bf8cdded3dc3004c1212a8d934336da Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 9 Jun 2020 09:55:52 -0400 Subject: [PATCH 3/5] Reformatting tests --- tests.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests.js b/tests.js index e689dd57..f5e7c9a8 100644 --- a/tests.js +++ b/tests.js @@ -30,7 +30,7 @@ test('state is reset when trigger mutation executed', t => { t.expect(store.state).toEqual(state) }) -test('only module state is reset when module mutation executed', ctx => { +test('only module state is reset when module mutation executed', t => { const rootMessage = 'Yo!' const songName = 'One Touch' const state = { message: 'Hello!' } @@ -59,19 +59,19 @@ test('only module state is reset when module mutation executed', ctx => { }) store.commit('message', rootMessage) store.commit('sample/song/name', songName) - ctx.expect(store.state['sample/song'].name).toBe(songName) + t.expect(store.state['sample/song'].name).toBe(songName) store.commit('sample/song/collection', 'Summer') - ctx.expect(store.state['sample/song'].collections).toEqual(['Summer']) - ctx.expect(store.state['sample/song'].map).toEqual({ Summer: 1 }) + t.expect(store.state['sample/song'].collections).toEqual(['Summer']) + t.expect(store.state['sample/song'].map).toEqual({ Summer: 1 }) store.commit('sample/song/reset') - ctx.expect(store.state.message).toBe(rootMessage) - ctx.expect(store.state['sample/song']).toEqual(songState) + t.expect(store.state.message).toBe(rootMessage) + t.expect(store.state['sample/song']).toEqual(songState) store.commit('sample/song/collection', 'Dance') store.commit('reset') - ctx.expect(store.state['sample/song']).toEqual(songState) + t.expect(store.state['sample/song']).toEqual(songState) }) -test('module state can be reset when registered dynamically', ctx => { +test('module state can be reset when registered dynamically', t => { const rootMessage = 'Yo!' const songName = 'One Touch' const state = { message: 'Hello!' } @@ -96,15 +96,15 @@ test('module state can be reset when registered dynamically', ctx => { store.registerModuleState('song', song) store.commit('message', rootMessage) store.commit('song/name', songName) - ctx.expect(store.state.song.name).toBe(songName) + t.expect(store.state.song.name).toBe(songName) store.commit('song/collection', 'Summer') - ctx.expect(store.state.song.collections).toEqual(['Summer']) + t.expect(store.state.song.collections).toEqual(['Summer']) store.commit('song/reset') - ctx.expect(store.state.message).toEqual(rootMessage) - ctx.expect(store.state.song).toEqual(songState) + t.expect(store.state.message).toEqual(rootMessage) + t.expect(store.state.song).toEqual(songState) }) -test('ssr state is used but can reset to initial state', ctx => { +test('ssr state is used but can reset to initial state', t => { const message = 'Yo!' const state = { message: 'Hello!', song: 'The Wheel' } const store = new Vuex.Store({ @@ -114,12 +114,12 @@ test('ssr state is used but can reset to initial state', ctx => { reset: () => true } }) - ctx.expect(store.state.message).toBe(message) + t.expect(store.state.message).toBe(message) store.commit('reset') - ctx.expect(store.state).toEqual(state) + t.expect(store.state).toEqual(state) }) -test('current route state is kept if it exists when reset', ctx => { +test('current route state is kept if it exists when reset', t => { const state = { message: 'Hello!' } const route = { path: '/' } const path = '/welcome' @@ -143,6 +143,6 @@ test('current route state is kept if it exists when reset', ctx => { store.commit('route/path', path) store.commit('message', 'Greetings!') store.commit('reset') - ctx.expect(store.state.message).toBe(state.message) - ctx.expect(store.state.route.path).toBe(path) + t.expect(store.state.message).toBe(state.message) + t.expect(store.state.route.path).toBe(path) }) From 2a14537045003b672e71f578ccbbed8d085b55e2 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 9 Jun 2020 10:02:05 -0400 Subject: [PATCH 4/5] Updating merge --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8e6d1aa8..9cd5a342 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ ], "dependencies": { "@ianwalter/clone": "^6.0.1", - "@ianwalter/merge": "^9.0.0-0" + "@ianwalter/merge": "^9.0.0-2" }, "devDependencies": { "@fullhuman/purgecss-loader": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index b54d21a0..40046cf5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -516,10 +516,10 @@ resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-6.0.0.tgz#7d7facccc86fb407571c78de00a0bd2adca395cb" integrity sha512-Ohskh/vqQFgW2Abaxd3kPYz/uNqoUmCSjU8kB8SoRieQqIOyXit1pFKYW4HmcoRcDFbktpWmS1QpIBoF74DGBg== -"@ianwalter/merge@^9.0.0-0": - version "9.0.0-0" - resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-9.0.0-0.tgz#318e47a86a741e84d872be37377865df96847879" - integrity sha512-pllC0tdkj7Cx/+d4hLE3nqtForGzDcQg3/0LpuHeroErjzV0DYG9MJcBLUkQ3zV7omrCx5T/EIFv4FosTBGdBQ== +"@ianwalter/merge@^9.0.0-2": + version "9.0.0-2" + resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-9.0.0-2.tgz#76747d016b106c2a0f35980c7539dff451936127" + integrity sha512-QBrCxTOIBKSDKEyN669vPc1OOgqAEhFFTYg54n1FtuN0vhSS94TRJRlpryZ/sqEGI2uaxe0JypZ0TnfxG/kQtA== "@ianwalter/npm-short-name@^1.0.0": version "1.0.0" From d0fe6f4ea669fdecf7a4d05355308c815f75acb6 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 9 Jun 2020 10:36:22 -0400 Subject: [PATCH 5/5] Updating merge for real this time --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9cd5a342..b65fe534 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ ], "dependencies": { "@ianwalter/clone": "^6.0.1", - "@ianwalter/merge": "^9.0.0-2" + "@ianwalter/merge": "^9.0.0-4" }, "devDependencies": { "@fullhuman/purgecss-loader": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index 40046cf5..21a1f594 100644 --- a/yarn.lock +++ b/yarn.lock @@ -516,10 +516,10 @@ resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-6.0.0.tgz#7d7facccc86fb407571c78de00a0bd2adca395cb" integrity sha512-Ohskh/vqQFgW2Abaxd3kPYz/uNqoUmCSjU8kB8SoRieQqIOyXit1pFKYW4HmcoRcDFbktpWmS1QpIBoF74DGBg== -"@ianwalter/merge@^9.0.0-2": - version "9.0.0-2" - resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-9.0.0-2.tgz#76747d016b106c2a0f35980c7539dff451936127" - integrity sha512-QBrCxTOIBKSDKEyN669vPc1OOgqAEhFFTYg54n1FtuN0vhSS94TRJRlpryZ/sqEGI2uaxe0JypZ0TnfxG/kQtA== +"@ianwalter/merge@^9.0.0-4": + version "9.0.0-4" + resolved "https://registry.yarnpkg.com/@ianwalter/merge/-/merge-9.0.0-4.tgz#eefb46c1ef866e7daa421237c3222fda5822ba1b" + integrity sha512-M0dxT2yn9WLbvDcdCqaeNzWuRgTv6pJmD2xHpxhvMRgA4jeP+/94lECGNTF1Fpchl80goc83qcyeUG5vLARmpw== "@ianwalter/npm-short-name@^1.0.0": version "1.0.0"