feat(app && tests): refactor

This commit is contained in:
2024-03-28 10:31:29 +03:00
parent 49626cb681
commit 6e6e5311b0
96 changed files with 946 additions and 928 deletions

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 layoutMachines } from '@/store/modules/layoutMachines';
describe('VChart', () => {
test('VChart mounted', () => {
const store = createStore({
modules: {
layoutMachines
}
})
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)
})
})