Skip to content

Instantly share code, notes, and snippets.

@achhunna
Last active May 5, 2019 01:59
Show Gist options
  • Save achhunna/3188e0cc1de7b78a0ec6aaa256f42e54 to your computer and use it in GitHub Desktop.
Save achhunna/3188e0cc1de7b78a0ec6aaa256f42e54 to your computer and use it in GitHub Desktop.
Jest test template
import { shallowMount } from '@vue/test-utils';
import Component from './component'; // name of your Vue component
let wrapper;
beforeEach(() => {
wrapper = shallowMount(Component, {
propsData: {},
mocks: {},
stubs: {},
methods: {},
});
});
afterEach(() => {
wrapper.destroy();
});
describe('Component', () => {
test('is a Vue instance', () => {
expect(wrapper.isVueInstance).toBeTruthy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment