Initial commit
This commit is contained in:
32
tests/store/freePacks.test.js
Normal file
32
tests/store/freePacks.test.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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]})
|
||||
})
|
||||
})
|
||||
33
tests/store/lastMachinesByPackNum.test.js
Normal file
33
tests/store/lastMachinesByPackNum.test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import {describe, test, expect, beforeEach} from 'vitest'
|
||||
import {createStore} from "vuex"
|
||||
import { store as machines } from '@/store/modules/machines'
|
||||
|
||||
describe('Test last machines by pack number store', () => {
|
||||
const store = createStore({
|
||||
modules: {
|
||||
machines
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
store.dispatch('machines/resetStore')
|
||||
})
|
||||
|
||||
test('Last machines should be a object', () => {
|
||||
expect(typeof machines).toBe('object')
|
||||
})
|
||||
|
||||
test('Last machines should be a array', () => {
|
||||
|
||||
const defaultMachinesStore = store.getters['machines/lastMachinesByPackNumber']
|
||||
|
||||
expect(defaultMachinesStore.length).toBe(0)
|
||||
expect(defaultMachinesStore).toEqual([])
|
||||
|
||||
store.dispatch('machines/setLastMachinesByPackNumber', [1, 2, 3])
|
||||
|
||||
const updatedMachinesStore = store.getters['machines/lastMachinesByPackNumber']
|
||||
|
||||
expect(updatedMachinesStore).toEqual([1, 2, 3])
|
||||
})
|
||||
})
|
||||
32
tests/store/lastPacks.test.js
Normal file
32
tests/store/lastPacks.test.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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])
|
||||
})
|
||||
})
|
||||
53
tests/store/layout.test.js
Normal file
53
tests/store/layout.test.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import {expect, describe, test, beforeEach} from 'vitest'
|
||||
import { createStore } from "vuex"
|
||||
import { store as layout } from '@/store/modules/layout';
|
||||
|
||||
describe('test of layout store', () => {
|
||||
const store = createStore({
|
||||
modules: {
|
||||
layout
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
store.dispatch('layout/resetStore')
|
||||
})
|
||||
|
||||
test('test layout store exist', async () => {
|
||||
expect(store).toBeTruthy()
|
||||
expect(store.getters['layout/isOpenedMobileMenu']).toBe(false)
|
||||
expect(store.getters['layout/isEnabledMenu']).toBe(true)
|
||||
})
|
||||
|
||||
test('test toggleMenu', () => {
|
||||
store.dispatch('layout/toggleMenu')
|
||||
const result = store.getters['layout/isShowMenu']
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
|
||||
test('test setIsShowMenu', () => {
|
||||
store.dispatch('layout/setIsShowMenu', false)
|
||||
const result = store.getters['layout/isShowMenu']
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
|
||||
test('test setIsMobileMenuOpened', () => {
|
||||
store.dispatch('layout/setIsMobileMenuOpened', true)
|
||||
const result = store.getters['layout/isOpenedMobileMenu']
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
test('test resetStore', () => {
|
||||
store.dispatch('layout/resetStore')
|
||||
const result = store.getters['layout/isShowMenu']
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
test('test initScreenSizeListener', () => {
|
||||
store.dispatch('layout/initScreenSizeListener')
|
||||
const result = store.getters['layout/initedScreenListener']
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
24
tests/store/machines.test.js
Normal file
24
tests/store/machines.test.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import {describe, test, expect, beforeEach} from 'vitest'
|
||||
import {createStore} from "vuex"
|
||||
import { store as machines } from '@/store/modules/machines';
|
||||
describe('machines store', () => {
|
||||
const store = createStore({
|
||||
modules: {
|
||||
machines
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
store.dispatch('machines/resetStore')
|
||||
})
|
||||
|
||||
test('machines should be a object', () => {
|
||||
expect(typeof machines).toBe('object')
|
||||
})
|
||||
|
||||
test('modalMachines should be a array', () => {
|
||||
expect(store.getters['machines/modalMachines']).toEqual([])
|
||||
store.dispatch('machines/setModalMachines', [1, 2, 3])
|
||||
expect(store.getters['machines/modalMachines']).toEqual([1, 2, 3])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user