I have a component Foo
with Vuex binding mockedVuexBinding
(which is essentially a computed prop).
I want to keep tests simple and don't want to mock the whole store. All vuex bindings I just replaced with computed stubs in test, like this:
const wrapper = shallowMount(Foo, {
computed: {
mockedVuexBinding: () => 'foo'
}
}
But then It turns out that I need to test some behavior from Foo
, which relays on change of computed property. So I want to update my computed with a value and test how component reacts on it (e.g. emits new value).
There is no such method as setComputed
by analogy with wrapper.setProps
or wrapper.setData
, so how can I do it? How to replace a mocked computed value with different value?