feat(app && tests): refactor
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
46
live_monitor_vue/tests/components/2_molecules/VChart.test.js
Normal file
46
live_monitor_vue/tests/components/2_molecules/VChart.test.js
Normal 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)
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
10
live_monitor_vue/tests/components/2_molecules/VModal.test.js
Normal file
10
live_monitor_vue/tests/components/2_molecules/VModal.test.js
Normal 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)
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user