eddyerburgh / vue-test-utils-vuex-example

Example repository testing vuex with vue-test-utils
53 stars 21 forks source link

Testing components with namespaced Vuex #12

Open francescq opened 5 years ago

francescq commented 5 years ago

Components using namespaced modules need: -to specify the namespace inside the component -testing: provide the whole store namespaced on new Vuex.Store

This makes the component to be coupled with the store and the namespace. When one needs to test an application with more than 50 nested modules, it's unmaintainable

Is the any way to inject to the component, as a prop or something, just the needed module of the store and keep the component module agnostic?

This would simplify a lot the tests and get rid of vuex warnings "module namespace not found..."

Hope I explained myself good enough, Thanks!