import {expect, describe, test, beforeEach} from 'vitest'
import {mount} from '@vue/test-utils'
import ServiceOfPacks from "@services/ServiceOfPacks.js"
import {ApiOfPacks} from "@mocks/packs.js"
import FreePacksPage from "@pages/FreePacks/index.vue"
import { createStore } from "vuex"
import { store as packs } from '@/store/modules/packs'

describe('test FreePacksPage', () => {

  const apiOfPacks = new ApiOfPacks()
  const store = createStore({
    modules: {
      packs
    }
  })

  beforeEach(() => {
    store.dispatch('packs/resetStore')
  })

  const serviceOfPacks = new ServiceOfPacks(apiOfPacks, store)

  test('exist test of FreePacksPage', async () => {

    const wrapper = mount(FreePacksPage, {
      shallow: true,
    })

    expect(wrapper.exists()).toBe(true)
  })

  test('Service serviceOfPacks should be a object', () => {
    expect(typeof serviceOfPacks).toBe('object')
  })

})


