// import '@/../tests/mocks/store'
import '@/../tests/mocks/main'
import '@/../tests/mocks/axios'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import BootstrapVue from 'bootstrap-vue'
import VueProgressBar from 'vue-progressbar'
import { createLocalVue } from '@vue/test-utils'
import Helpers from '@/plugins/helpers'
import Icon from 'vue-awesome/components/Icon'
import '@/config/custom-icons'
import ibsTemplate from '@/plugins/template'
import TemplateConfig from '@/config/template'
import vuexI18n from 'vuex-i18n'
import VeeValidate from 'vee-validate'
import constants from '@/config/const'
import app_settings from '@/config/app-settings'

export default function(options = {}) {
  options = {
    appSettings: {},
    ...options,
  }
  const localVue = createLocalVue()

  localVue.config.debug = true

  localVue.use(VueRouter)
  localVue.use(BootstrapVue)
  localVue.use(Vuex)
  localVue.use(vuexI18n.plugin, new Vuex.Store(), {
    warnings: false,
  })
  localVue.use(Helpers)
  localVue.use(VueProgressBar)
  localVue.use(VeeValidate, {
    inject: false,
  })
  localVue.component('icon', Icon)
  localVue.use(ibsTemplate, TemplateConfig)

  localVue.use({
    install: function() {
      localVue.prototype.$analytics = jest.fn()
    },
  })

  localVue.use({
    install: function() {
      Object.defineProperty(localVue.prototype, '$const', {
        get() {
          return constants
        },
      })
    },
  })

  localVue.use({
    install: function() {
      Object.defineProperty(localVue.prototype, '$appSettings', {
        get() {
          return {
            ...app_settings,
            ...options.appSettings,
          }
        },
      })
    },
  })

  return localVue
}
