-
Notifications
You must be signed in to change notification settings - Fork 666
How to replace a vuex getter after a wrapper has been mounted #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What weould the API look like? wrapper.reMount(mountingOptions)? I don't think that's something that should be added to the library. FYI I write tests by creating a fresh wrapper in each test. If I have lots of repetition, I write |
@eddyerburgh OK cool, so same as my workflow :) I just wanted to do a check if I am doing it wrong or not. |
You may also use smt like:
|
Thanks @mwager , I ended up doing something like Object.defineProperty(wrapper.vm, 'someComputedProp', { value: undefined, writable: true })
...
wrapper.vm.someComputedProp = 0
await wrapper.vm.$forceUpdate()
...
wrapper.vm.someComputedProp = 10
await wrapper.vm.$forceUpdate()
... |
What problem does this feature solve?
If a component is mounted in beforeEach with a mocked Vuex Store, how do you change a getter implementation in the store just for one test? The store is already mounted so replacing with
.mockImplementationOnce
doesnt work.Currently I need to recreate the store and remount the component for that to work.
What does the proposed API look like?
If we can have a refresh or remount method on the wrapper that would refresh the component.
Other way would be to feed it a new Store but I dont think that is possible at all.
The text was updated successfully, but these errors were encountered: