{"id":21009220,"url":"https://github.com/shisama/vuex-snapshot-test","last_synced_at":"2025-05-15T02:33:04.373Z","repository":{"id":34179546,"uuid":"168842659","full_name":"shisama/vuex-snapshot-test","owner":"shisama","description":"Snapshot testing library for Vuex. ","archived":false,"fork":false,"pushed_at":"2024-11-18T19:57:57.000Z","size":299,"stargazers_count":5,"open_issues_count":34,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-18T20:54:33.949Z","etag":null,"topics":["action-testing","mutation-testing","snapshot","snapshot-store","snapshot-testing","testing","vue","vuex","vuex-test"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vuex-snapshot-test","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shisama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-02T14:57:06.000Z","updated_at":"2022-04-20T15:53:25.000Z","dependencies_parsed_at":"2023-10-03T00:15:51.159Z","dependency_job_id":"7d61769e-bad0-4373-9ccf-b8d0f4638ed7","html_url":"https://github.com/shisama/vuex-snapshot-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shisama%2Fvuex-snapshot-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shisama%2Fvuex-snapshot-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shisama%2Fvuex-snapshot-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shisama%2Fvuex-snapshot-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shisama","download_url":"https://codeload.github.com/shisama/vuex-snapshot-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225253856,"owners_count":17445085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action-testing","mutation-testing","snapshot","snapshot-store","snapshot-testing","testing","vue","vuex","vuex-test"],"created_at":"2024-11-19T09:15:56.431Z","updated_at":"2024-11-19T09:15:57.163Z","avatar_url":"https://github.com/shisama.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vuex-snapshot-test\n[![Build Status](https://travis-ci.org/shisama/vuex-snapshot-test.svg?branch=master)](https://travis-ci.org/shisama/vuex-snapshot-test) \n[![npm version](https://badge.fury.io/js/vuex-snapshot-test.svg)](https://badge.fury.io/js/vuex-snapshot-test)  \nSnapshot testing library for Vuex.\nInspired by [reducer-tester](https://github.com/akameco/reducer-tester).\n\n## TL;DR\n\nTest Code\n\n```js\nimport snapshot from \"vuex-snapshot-test\";\nimport store from \"@/store\";\n\nsnapshot({\n  store, // state: 0\n  dispatches: [dispatch =\u003e dispatch(\"increment\")]\n});\n```\n\nSnapshot\n\n```diff\nexports[`increment 1`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 0,\n+     \\\\\"value\\\\\": 1,\n    },\n  }\"\n`;\n```\n\n\n## Install\n\n```\nnpm install --save-dev vuex-snapshot-test\n```\n\nor\n\n```\nyarn add --dev vuex-snapshot-test\n```\n\n\n## Usage\n\nVuex Store\n\n```js\n// store.js\nimport Vue from \"vue\";\nimport Vuex from \"vuex\";\n\nVue.use(Vuex);\n\nconst state = {\n  counter: {\n    value: 1\n  }\n};\n\nconst mutations = {\n  increment: state =\u003e state.counter.value++,\n  decrement: state =\u003e state.counter.value--,\n  multiply: (state, payload) =\u003e {\n    state.counter.value = state.counter.value * payload.num;\n  }\n};\n\nconst actions = {\n  increment: ({ commit }) =\u003e commit(\"increment\"),\n  decrement: ({ commit }) =\u003e commit(\"decrement\"),\n  multiply: ({ commit }, num) =\u003e\n    commit(\"multiply\", {\n      num\n    })\n};\nconst store = new Vuex.Store({\n  state,\n  mutations,\n  actions\n});\n```\n\nTest Code\n\n```js\n// store.test.js\nimport snapshot from \"vuex-snapshot-test\";\nimport store from \"@/store\";\n\ndescribe(\"test_describe\", () =\u003e {\n  // pass state, mutations, and tests parameters.\n  snapshot({\n    state: {\n      counter: {\n        value: 1\n      }\n    },\n    mutations,\n    tests: [\n      {\n        type: \"increment\"\n      },\n      {\n        type: \"multiply\",\n        num: 5\n      }\n    ]\n  });\n\n  // pass store and dispatches parameters.\n  snapshot({\n    store,\n    dispatches: [\n      dispatch =\u003e dispatch(\"increment\"),\n      dispatch =\u003e dispatch(\"multiply\", 5)\n    ]\n  });\n\n  // pass store and commits parameters.\n  snapshot({\n    store,\n    commits: [\n      commit =\u003e commit(\"increment\"),\n      commit =\u003e commit(\"decrement\"),\n      commit =\u003e commit(\"multiply\", { num: 5 })\n    ]\n  });\n});\n\n```\n\nSnapshot\n\n```diff\nexports[`test_describe decrement 1`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 0,\n    },\n  }\"\n`;\n\nexports[`test_describe increment 1`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 2,\n    },\n  }\"\n`;\n\nexports[`test_describe increment 2`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 2,\n    },\n  }\"\n`;\n\nexports[`test_describe increment 3`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 2,\n    },\n  }\"\n`;\n\nexports[`test_describe multiply 1`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 5,\n    },\n  }\"\n`;\n\nexports[`test_describe multiply 2`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 5,\n    },\n  }\"\n`;\n\nexports[`test_describe multiply 3`] = `\n\"Snapshot Diff:\n- Before\n+ After\n\n  Object {\n    \\\\\"counter\\\\\": Object {\n-     \\\\\"value\\\\\": 1,\n+     \\\\\"value\\\\\": 5,\n    },\n  }\"\n`;\n```\n\n\n## Contributing\nIssues and Pull requests are welcome ;)\n\n## License\nThis project is licensed under the terms of the\n[MIT license](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshisama%2Fvuex-snapshot-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshisama%2Fvuex-snapshot-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshisama%2Fvuex-snapshot-test/lists"}