Cross-module store testing support
Closes #305 (closed)
The FakeStore
has been largely rewritten to support namespaced store modules, in a way inspired by Vuex's own implementation of modules: the global store has everything in it, and the fake modules just act as 'local contexts' for their module's mutations, actions and getters, proxying everything to the One True FakeStore. This has multiple consequences:
- Tests should no longer have their own FakeStore and instead use the default export from
~/test/store
, which provides a global store; - Tests should still have
store.reset()
in theirafterEach()
hook; - Non-namespaced modules (any module without
namespaced: true
) are generally confusing and we don't use them; this FakeStore does not support them and will cause the tests to fail, instead of giving developers headaches; - Forgetting to add your module to the global list will cause a few tests to fail, unlike before;
- Changes in a module can affect another module's tests if it calls something from this module;
- This is a breaking change, all test files that used FakeStores had to be changed to add support for this new system;
- Tests will now have to include the module prefix everywhere, e.g.
elementsv2/set
instead ofset
.
Edited by Erwan Rouchet