I'm pretty new in Vue js, and I'm starting with unit testing with Jest. I don't have any idea where and how to start. I have this piece of Vue code that i would like to test using Jest. Any tips or idea I'll be so thankful. I read that I should use shallowMount from Vue test-utils to avoid troubles during the component testing
<template >
<div class="wrapper">
<div class="user">
<span>{{ user.substr(0, 4) }}</span>
</div>
</div>
</template>
<script>
export default {
props: {
user: {
type: String,
required: true
}
}
}
</script>
At the moment I have something like this, but I don't know how to conitnue
import { shallowMount } from '@vue/test-utils'
import User from '../User.vue'
describe('User', () => {
it('Should substract four letters', () => {
const wrapper = shallowMount(User, {
props: {
''
}
})
})
})