Last active
August 22, 2022 12:18
-
-
Save jorgeguberte/18425ffc914556e1ad23474e02def632 to your computer and use it in GitHub Desktop.
Component Factory for Testing in Vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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