Add unit test snippet
gengjiawen opened this issue · 2 comments
gengjiawen commented
Test every component looks have a lot in common, can we make this a snippet ?
import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
describe('HelloWorld.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(HelloWorld)
const vm = new Constructor().$mount()
expect(vm.$el.querySelector('.hello h1').textContent)
.to.equal('Welcome to Your Vue.js App')
})
})
sdras commented
This is a fantastic idea. I'll definitely include it. I'll also accept a PR, if anyone is interested. Thanks!
sdras commented
Added in! You may have to restart VS Code to get it. I put in some tab markers for the component, etc, let me know if everything works ok.
Thanks!