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 LastPacksPage from "@pages/LastPacks/index.vue"
import { createStore } from "vuex"
import { store as packs } from '@/store/modules/packs'

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

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

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

  const serviceOfPacks = new ServiceOfPacks(apiOfPacks, store)

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

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

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

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

})


