Skip to content

Instantly share code, notes, and snippets.

@jorgeguberte
Last active August 22, 2022 12:18
Show Gist options
  • Save jorgeguberte/18425ffc914556e1ad23474e02def632 to your computer and use it in GitHub Desktop.
Save jorgeguberte/18425ffc914556e1ad23474e02def632 to your computer and use it in GitHub Desktop.
Component Factory for Testing in Vue
/*
* as per https://www.youtube.com/watch?v=L_BK8zXGdBM&ab_channel=VueConfToronto
*/
import {shallowMount} from '@vue/test-utils';
describe('test using Component factory', ()=>{
let wrapper;
//Factory
function createComponent(){
wrapper = shallowMount(MyComponent, {/* optional parameters */});
}
//Destroy wrappers
afterEach(()=>{
wrapper.destroy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment