Open alecgibson opened 4 years ago
Okay, so current hacky workaround:
sinon.stub(MyModule.store, 'getters').value({
...MyModule.store.getters,
'myModule/propertyA': () => 'foo',
});
It would be nice if we could just set the getters as configurable, though, maybe as an option in the @Module
decorator? eg
@Module({name: 'myModule', namespaced: true, stateFactory: true, mockable: true})
export default class MyModule extends VuexModule {}
did you find a better way?
@mariosh346 nope, this is still my best approach 😞
Given a module:
If I'd like to stub
propertyA
for testingpropertyB
, I'd normally write:However, in this case the getter is non-configurable, so I just get:
Is there any way to make these getters configurable (just in tests, obviously)?