Initial commit

This commit is contained in:
2024-04-24 11:13:56 +03:00
commit 22d37bb0a4
301 changed files with 86455 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import Accordion from '@atoms/VAccordion.vue';
describe('Accordion', () => {
test('Accordion mounted', () => {
const wrapper = mount(Accordion)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import VButton from '@atoms/VButton.vue';
describe('VButton', () => {
test('VButton mounted', () => {
const wrapper = mount(VButton)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import ButtonDiscard from '@atoms/ButtonDiscard.vue';
describe('ButtonDiscard', () => {
test('ButtonDiscard mounted', () => {
const wrapper = mount(ButtonDiscard)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import ButtonEdit from '@atoms/ButtonEdit.vue';
describe('ButtonEdit', () => {
test('ButtonEdit mounted', () => {
const wrapper = mount(ButtonEdit)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import ButtonSave from '@atoms/ButtonSave.vue';
describe('ButtonSave', () => {
test('ButtonSave mounted', () => {
const wrapper = mount(ButtonSave)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,15 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import DoubleSwitch from '@atoms/DoubleSwitch.vue';
describe('DoubleSwitch', () => {
test('DoubleSwitch mounted', () => {
const wrapper = mount(DoubleSwitch, {
global: {
provide: {
isChecked: false
}}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, vi} from 'vitest'
import { mount} from '@vue/test-utils'
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue';
describe('ButtonModal', () => {
test('ButtonModal mounted', () => {
const wrapper = mount(ButtonModal)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, vi} from 'vitest'
import { mount} from '@vue/test-utils'
import MachinesModal from '@molecules/MachinesModal/MachinesModal.vue';
describe('MachinesModal', () => {
test('MachinesModal mounted', () => {
const wrapper = mount(MachinesModal)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import MapModal from '@molecules/MapModal/MapModal.vue';
describe('MapModal', () => {
test('MapModal mounted', () => {
const wrapper = mount(MapModal)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,46 @@
import {test, describe, expect, vi} from 'vitest'
import { shallowMount } from '@vue/test-utils'
import VChart from '@molecules/VChart/VChart.vue';
import { createStore } from 'vuex';
import { store as layout_machines } from '@/store/modules/layout_machines';
describe('VChart', () => {
test('VChart mounted', () => {
const store = createStore({
modules: {
layout_machines
}
})
vi.mock('@store/hooks/Echarts', () => {
const html = vi.fn(() => {
return {
getHtml: () => {
return '<div>test</div>'
},
onClickedBarCharts: vi.fn()
}
})
return {
__esModule: true,
ECharts: html
}
})
const wrapper = shallowMount(VChart, {
props: {
id: "",
type: "bar",
},
global: {
mocks: {
$store: store
}
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,18 @@
import {test, describe, expect, vi} from 'vitest'
import { mount} from '@vue/test-utils'
import VDatepicker from '@molecules/VDatepicker/VDatepicker.vue';
describe('VDatepicker', () => {
test('VDatepicker mounted', () => {
const wrapper = mount(VDatepicker,
{
global: {
provide: {
defaultDate: null
}
}
}
)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import VModal from '@molecules/VModal/VModal.vue';
describe('VModal', () => {
test('VModal mounted', () => {
const wrapper = mount(VModal)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import VSpinner from '@molecules/VSpinner/VSpinner.vue';
describe('VSpinner', () => {
test('VSpinner mounted', () => {
const wrapper = mount(VSpinner)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,31 @@
import {test, describe, expect, vi } from 'vitest'
import { mount} from '@vue/test-utils'
import VTabulator from '@molecules/VTabulator/VTabulator.vue';
describe("tests VTabulator component", () => {
vi.mock('tabulator-tables', () => {
const tabulator = vi.fn(() => {
return {
getHtml: () => {
return '<div>test</div>'
}
}
})
return {
__esModule: true,
TabulatorFull: tabulator
}
})
test('exist test of VTabulator', async () => {
const wrapper = mount(VTabulator, {
shallow: true,
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,27 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainer from '@frames/AppContainer/AppContainer.vue';
import {createStore} from "vuex";
import { store as layout } from '@/store/modules/layout';
import { store as auth } from '@/store/modules/auth';
describe('AppContainer', () => {
const store = createStore({
modules: {
layout,
auth
},
})
test('AppContainer mounted', () => {
const wrapper = shallowMount(AppContainer,
{
global: {
mocks: {
$store: store,
},
}}
)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainerBreadcrumbs from '@frames/AppContainer/AppContainerBreadcrumbs.vue';
describe('AppContainerBreadcrumbs', () => {
test('AppContainerBreadcrumbs mounted', () => {
const wrapper = shallowMount(AppContainerBreadcrumbs)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainerHeader from '@frames/AppContainer/AppContainerHeader.vue';
describe('AppContainerHeader', () => {
test('AppContainerHeader mounted', () => {
const wrapper = shallowMount(AppContainerHeader)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,16 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainerLeftPanel from '@frames/AppContainer/AppContainerLeftPanel.vue';
import Router from "@router"
describe('AppContainerLeftPanel', () => {
test('AppContainerLeftPanel mounted', () => {
const wrapper = shallowMount(AppContainerLeftPanel,
{
global: {
plugins: [Router]
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,15 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainerMobileMenu from '@frames/AppContainer/AppContainerMobileMenu.vue';
describe('AppContainerMobileMenu', () => {
test('AppContainerMobileMenu mounted', () => {
const wrapper = shallowMount(AppContainerMobileMenu, {
props: {
isOpenedMobileMenu: false,
setIsMobileMenuOpened: () => {},
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,20 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import AppContainerRightPanel from '@frames/AppContainer/AppContainerRightPanel.vue';
import Router from "@router"
describe('AppContainerRightPanel', () => {
test('AppContainerRightPanel mounted', () => {
const wrapper = shallowMount(AppContainerRightPanel, {
props: {
currentUser: {
id: 1,
}
},
global: {
plugins: [Router]
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,15 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import MenuList from '@frames/AppContainer/MenuList/MenuList.vue';
describe('MenuList', () => {
test('MenuList mounted', () => {
const wrapper = shallowMount(MenuList, {
props: {
routeName: ""
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,11 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import MenuListItem from '@frames/AppContainer/MenuList/MenuListItem.vue';
describe('MenuListItem', () => {
test('MenuListItem mounted', () => {
const wrapper = shallowMount(MenuListItem)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import MenuListItemCopy from '@frames/AppContainer/MenuList/MenuListItemCopy.vue';
describe('MenuListItemCopy', () => {
test('MenuListItemCopy mounted', () => {
const wrapper = shallowMount(MenuListItemCopy)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import MenuListItemGroup from '@frames/AppContainer/MenuList/MenuListItemGroup.vue';
describe('MenuListItemGroup', () => {
test('MenuListItemGroup mounted', () => {
const wrapper = shallowMount(MenuListItemGroup)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,17 @@
import {test, describe, expect, } from 'vitest'
import { shallowMount} from '@vue/test-utils'
import MenuListItemImplementation from '@frames/AppContainer/MenuList/MenuListItemImplementation.vue';
import Router from "@router"
describe('MenuListItemImplementation', () => {
test('MenuListItemImplementation mounted', () => {
const wrapper = shallowMount(MenuListItemImplementation,
{
global: {
plugins: [Router]
}
})
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import PacksContainer from '@frames/PacksContainer/PacksContainer.vue';
describe('PacksContainer', () => {
test('PacksContainer mounted', () => {
const wrapper = mount(PacksContainer)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import PacksContainerBody from '@frames/PacksContainer/PacksContainerBody.vue';
describe('PacksContainerBody', () => {
test('PacksContainerBody mounted', () => {
const wrapper = mount(PacksContainerBody)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,10 @@
import {test, describe, expect} from 'vitest'
import { mount} from '@vue/test-utils'
import PacksContainerControl from '@frames/PacksContainer//PacksContainerControl.vue';
describe('PacksContainerControl', () => {
test('PacksContainerControl mounted', () => {
const wrapper = mount(PacksContainerControl)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,77 @@
import {it, describe, expect} from 'vitest'
import Services from '@admin_pages/Services/Services.vue'
import { globalServices } from '@store/modules/services/StaticData'
import { mount } from '@vue/test-utils'
import {createStore} from 'vuex'
const store = createStore({
state() {
return {
services: globalServices,
}
},
getters: {
services: (state) => state.services,
},
mutations: {
setServices: (state, updateValue) => state.services = updateValue,
},
})
describe("6_admin_pages, page of Services", () => {
it("renders Services, with custom button title", () => {
const wrapper = mount(Services, {
global: {
plugins: [store],
},
data () {
return {
titleServicesButton: 'Показать больше сервисов',
}
},
})
expect(wrapper.text()).toContain('Показать больше сервисов')
})
})
describe("Services", () => {
it("renders after click button, open full Services", async () => {
const wrapper = mount(Services, {
global: {
plugins: [store],
},
})
await wrapper.find('button').trigger('click')
expect(wrapper.find('button').text()).toContain('Скрыть')
})
})
describe("Services", () => {
it("renders Services with exists data", async () => {
const wrapper = mount(Services, {
global: {
plugins: [store],
},
})
expect(store.state.services.length).toBeGreaterThan(0)
expect(wrapper.exists()).toBe(true)
})
})
describe("Services", () => {
it("renders Services maked empty data", async () => {
const wrapper = mount(Services, {
global: {
plugins: [store],
},
})
store.commit('setServices', [])
expect(store.state.services.length).toBe(0)
expect(wrapper.exists()).toBe(true)
})
})

View File

@@ -0,0 +1,109 @@
import {test, describe, expect} from 'vitest'
import Service from '@admin_pages/Services/ServicesServiceItem.vue'
import { globalServices } from '@store/modules/services/StaticData'
import { store as logger } from '@/store/modules/logger';
import { mount } from '@vue/test-utils'
import {createStore} from 'vuex'
const store = createStore({
modules: {
logger,
services: globalServices,
},
})
describe("6_admin_pages, ServicesServiceItem", () => {
test("renders Service, with set props value", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
idx: 1,
}
})
await wrapper.setProps({ idx: 3 })
expect(wrapper.html()).toContain(3)
})
test("renders Service with condition success", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
name: '',
},
})
await wrapper.setProps({ name: 'глобальное хранилище' })
expect(wrapper.html()).toContain('доступен')
})
test("renders Service with condition not success", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
name: '',
},
})
await wrapper.setProps({ name: 'Test service name' })
expect(wrapper.html()).toContain('отключен')
})
test("renders Service if not service details", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
service: {},
},
})
expect(wrapper.html()).toContain('Сервис глобального хранилища применяется для условно постоянного хранения данных в кэше')
})
test("renders Service with set service details", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
service: {serviceIp: '192.168.1.1', serviceCode: '1234567890', serviceLink: 'http://test.com', is_online: false,
},
},
})
await wrapper.setProps({ service: {serviceIp: '192.168.1.7', serviceCode: '1234567897', is_online: true} }) // 1 раз, далее новый тест
expect(wrapper.html()).toContain('192.168.1.7')
expect(wrapper.html()).toContain('1234567897')
expect(wrapper.html()).toContain('доступен')
expect(wrapper.html()).toContain('... нет описания')
})
test("renders Service with alert copyText success after click", async () => {
const wrapper = mount(Service, {
global: {
plugins: [store],
},
props: {
copyed: '',
service: {init_params: {service: 'Test service', machine_addr: 'Test machine_addr'}},
},
})
await wrapper.get('.copyText').trigger('click')
expect(wrapper.html()).toContain('copyed')
})
})