lundi 4 novembre 2019

Snapshot with nuxt and vue not creating correct snapshot

I'm trying to use snapshot with my newly installed nuxt app.

My test is:

import { shallowMount, createLocalVue } from '@vue/test-utils'
import Component from '@/components/home/Component.vue'
import BootstrapVue from 'bootstrap-vue'

const localVue = createLocalVue();
localVue.use(BootstrapVue);

const factory = () => {
  return shallowMount(Component, {
    localVue
  });
};

describe('Component', () => {
  test('renders correctly', () => {
    const wrapper = factory();
    expect(wrapper).toMatchSnapshot()
  })
})

The snapshot it seems to create is this:

exports[`Component renders correctly 1`] = `
VueWrapper {
  "_emitted": Object {},
  "_emittedByOrder": Array [],
  "isFunctionalComponent": undefined,
}
`;

I'm unsure why?

Aucun commentaire:

Enregistrer un commentaire