import {describe, test, expect, beforeEach} from 'vitest'
import {createStore} from "vuex"
import { store as packs } from '@/store/modules/packs'

describe('Test free packs store', () => {
  const store = createStore({
    modules: {
      packs
    }
  })

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

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

  test('Free packs should be a object, set and get from store', async () => {

    const defaultPacksStore = store.getters['packs/freePacks']

    expect(defaultPacksStore).toEqual({})

    store.dispatch('packs/setFreePacks', {"maxDataLength": 70, logs:[1, 2, 3]})

    const freePacksStore = store.getters['packs/freePacks']
    
    expect(freePacksStore).toEqual({"maxDataLength": 70, logs:[1, 2, 3]})
  })
})