import { mount } from '@vue/test-utils' ; import { defineComponent } from 'vue' ; export type RenderHookResult < T > = { result ? : T ; } ; export const renderHook = < Result > ( callback = ( ) => { } ) : RenderHookResult < Result > => { let result ; const Container = defineComponent ( { setup ( ) { result = callback ( ) ; return result ; } , render ( ) { return null ; } , } ) ; mount ( Container ) ; return { result , } ; } ; export const waitForNextUpdate = ( timeout ? ) => new Promise ( ( resolve ) => { setTimeout ( ( ) => { resolve ( undefined ) ; } , timeout ) ; } ) ;