Helpers.ts 715 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { Store } from 'vuex'
  2. import VuexORM from '@vuex-orm/core'
  3. import VueCompositionAPI from '@vue/composition-api';
  4. import { mount, createLocalVue } from '@vue/test-utils'
  5. import { AnyJson } from '~/types/interfaces'
  6. const localVue = createLocalVue()
  7. localVue.use(VueCompositionAPI);
  8. export function initLocalVue (ctx:AnyJson) {
  9. localVue.prototype.$nuxt = {
  10. context: ctx
  11. }
  12. }
  13. export function mountComposition (cb: () => any) {
  14. return mount(
  15. {
  16. setup () {
  17. return cb()
  18. },
  19. render (h) {
  20. return h('div')
  21. }
  22. },
  23. { localVue }
  24. )
  25. }
  26. export function createStore (): Store<any> {
  27. return new Store({
  28. plugins: [VuexORM.install()],
  29. strict: true
  30. })
  31. }