Open nathan815 opened 4 years ago
You can look at the tests folder for some examples of how I test the repo itself, which is not far from what you're trying to do.
To test the actions/getters/mutations independently, I've used jest + manual mocks (__mocks__/
) with some success. You end up needing to separate the actions/getters/mutations into their own files, independent of the store.
Great little library - thanks for making this! 💯
I am now trying to figure out how to mock the store for testing. In vue-test-utils docs it talks about creating a store by instantiating a
Vuex.Store
and setting up a localVue instance. However, with vuex-typex we useStoreBuilder.vuexStore()
instead to create a store and then call the modules' strongly typed functions rather thanVuex.Store
methods.My goal is to be able to
jest.fn
) for call verificationHas anyone figured out how to do this with vuex-typex? I think I know how setting initial state and asserting state would work, but I am not sure how to pass in mock actions/getters for given module(s) to the store.
Also, what would be the "best" way to unit test the store's actions/getters/mutations themselves?