Having an issue with unit testing a Vue component that dynamically loads its child component. Jest and Vue utils don't seem to render it. Any suggestions on how to tackle this?
Here's the component code:
<template>
<component :is="component" v-bind="props" />
</template>
<script>
const components = {
dog: () => import('./dog.vue'),
cat: () => import('./cat.vue')
}
export default {
props: { type: String }
computed: {
component() {
return components[this.type]
}
props() { ... }
}
}
</script>
This is how my test looks like:
...
it('renders correctly', async () => {
const wrapper = mount(Component, { ... })
expect(wrapper.element).toMatchSnapshot()
})
...
And here's the snapshot file I'm getting:
// Jest Snapshot v1
exports[`Markdown Token renders correctly 1`] = `<!---->`;
Appreciate any help in advance :)