32 lines
806 B
JavaScript
32 lines
806 B
JavaScript
import {describe, test, expect, beforeEach} from 'vitest'
|
|
import {createStore} from "vuex"
|
|
import { store as packs } from '@/store/modules/packs';
|
|
describe('Test last packs store', () => {
|
|
const store = createStore({
|
|
modules: {
|
|
packs
|
|
}
|
|
})
|
|
|
|
beforeEach(() => {
|
|
store.dispatch('packs/resetStore')
|
|
})
|
|
|
|
test('Packs should be a object', () => {
|
|
expect(typeof packs).toBe('object')
|
|
})
|
|
|
|
test('Last packs should be a array, set and get from store', () => {
|
|
|
|
const defaultPacksStore = store.getters['packs/lastPacks']
|
|
|
|
expect(defaultPacksStore.length).toBe(0)
|
|
expect(defaultPacksStore).toEqual([])
|
|
|
|
store.dispatch('packs/setLastPacks', [1, 2, 3])
|
|
|
|
const newPacksStore = store.getters['packs/lastPacks']
|
|
|
|
expect(newPacksStore).toEqual([1, 2, 3])
|
|
})
|
|
}) |