Helpers.ts 622 B

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