I faced with a problem that my component wrapper can't be initialized when the component being tested has mixins. When I comment it everything is fine.
This is my component wrapper with mixins mock which I use in tests:
beforeEach(() => {
dealsSortingMixin = {
methods: {
sortUpBy: jest.fn(),
sortDownBy: jest.fn()
}
}
mixins = [
dealsSortingMixin
]
wrapper = shallow(Component, {
localVue,
store,
filters,
mixins,
attachToDocument: true
})
})
So, if the component being tested has mixins:
export default {
...
mixins: [
dealsSortingMixin
],
...
}
I have errors that the wrapper is undefined. If I comment mixins the wrapper is successfully initialized. What is the reason of it?
Aucun commentaire:
Enregistrer un commentaire