example.spec.js 594 B

1234567891011121314151617181920212223
  1. <%_ if (!hasTS) { _%>
  2. import { shallowMount } from '@vue/test-utils'
  3. <%_ if (!rootOptions.bare) { _%>
  4. import HelloWorld from '@/components/HelloWorld.vue'
  5. describe('HelloWorld.vue', () => {
  6. it('renders props.msg when passed', () => {
  7. const msg = 'new message'
  8. const wrapper = shallowMount(HelloWorld, {
  9. propsData: { msg }
  10. })
  11. expect(wrapper.text()).toMatch(msg)
  12. })
  13. })
  14. <%_ } else { _%>
  15. import App from '@/App.vue'
  16. test('App should work', () => {
  17. const wrapper = shallowMount(App)
  18. expect(wrapper.text()).toMatch(`Welcome to Your Vue.js App`)
  19. })
  20. <%_ } _%>
  21. <%_ } _%>