fix: 修改测试用例
This commit is contained in:
@@ -3,7 +3,8 @@ import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import ElementPlus from 'element-plus'
|
||||
import { mockData } from './mockData/NetworkOverviewApps'
|
||||
|
||||
import common from '@/mixins/common'
|
||||
import chartMixin from '@/views/charts2/chart-mixin'
|
||||
const chart = mockData.common.chart
|
||||
|
||||
const linkInfo = 5
|
||||
@@ -49,7 +50,13 @@ function axiosPostAndMounted (Metric, flag, data) {
|
||||
},
|
||||
global: {
|
||||
plugins: [ElementPlus]
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import NetworkOverviewDdosDetection from '@/views/charts2/charts/networkOverview/NetworkOverviewDdosDetection'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import common from '@/mixins/common'
|
||||
import chartMixin from '@/views/charts2/chart-mixin'
|
||||
import { mockData } from './mockData/NetworkOverviewDdosDetection'
|
||||
|
||||
const mockGet = mockData.common
|
||||
@@ -25,7 +27,8 @@ function axiosPostAndMounted (data) {
|
||||
wrapper = mount(NetworkOverviewDdosDetection, {
|
||||
propsData: {
|
||||
timeFilter
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ import NetworkOverviewLine from '@/views/charts2/charts/networkOverview/NetworkO
|
||||
import { mount } from '@vue/test-utils'
|
||||
import axios from 'axios'
|
||||
import mockData from './NetworkOverviewLineMockData'
|
||||
import common from '@/mixins/common'
|
||||
import chartMixin from '@/views/charts2/chart-mixin'
|
||||
|
||||
const timeFilter = {
|
||||
dateRangeValue: -1,
|
||||
@@ -22,7 +24,13 @@ describe('views/charts2/charts/networkOverview/NetworkOverviewLine.vue测试', (
|
||||
propsData: {
|
||||
timeFilter,
|
||||
chart
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
// 延迟等待渲染。使用wrapper.vm.$nextTick有时不管用(例如组件中使用了setTimeout的时候)
|
||||
await new Promise(resolve => setTimeout(async () => {
|
||||
@@ -48,7 +56,13 @@ describe('views/charts2/charts/networkOverview/NetworkOverviewLine.vue测试', (
|
||||
propsData: {
|
||||
timeFilter,
|
||||
chart
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
// 延迟等待渲染。使用wrapper.vm.$nextTick有时不管用(例如组件中使用了setTimeout的时候)
|
||||
await new Promise(resolve => setTimeout(async () => {
|
||||
@@ -77,7 +91,13 @@ describe('views/charts2/charts/networkOverview/NetworkOverviewLine.vue测试', (
|
||||
propsData: {
|
||||
timeFilter,
|
||||
chart
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
|
||||
// 延迟等待渲染。使用wrapper.vm.$nextTick有时不管用(例如组件中使用了setTimeout的时候)
|
||||
@@ -106,7 +126,13 @@ describe('views/charts2/charts/networkOverview/NetworkOverviewLine.vue测试', (
|
||||
timeFilter,
|
||||
chart,
|
||||
metric: 'Packets/s'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
|
||||
await new Promise(resolve => setTimeout(async () => {
|
||||
@@ -129,7 +155,13 @@ describe('views/charts2/charts/networkOverview/NetworkOverviewLine.vue测试', (
|
||||
timeFilter,
|
||||
chart,
|
||||
metric: 'Sessions/s'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isUnitTesting: true
|
||||
}
|
||||
},
|
||||
mixins: [common, chartMixin]
|
||||
})
|
||||
|
||||
await new Promise(resolve => setTimeout(async () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const mockData = {
|
||||
// 空
|
||||
empty: {
|
||||
status: 200,
|
||||
data: {
|
||||
"status": 200,
|
||||
"code": 200,
|
||||
@@ -13,6 +14,7 @@ const mockData = {
|
||||
bytes: {
|
||||
// 边界
|
||||
boundary: {
|
||||
status: 200,
|
||||
data: {
|
||||
"status": 200,
|
||||
"code": 200,
|
||||
@@ -66,6 +68,7 @@ const mockData = {
|
||||
},
|
||||
// 正常数据
|
||||
common: {
|
||||
status: 200,
|
||||
data: {"status":200,"code":200,"data":{"resultType":"object","result":[{"type":"bytes","totalBitsRate":{"values":[[1673247564,"96801019.52"]],"analysis":{"avg":"112042808.24","max":"301842105.76","min":"52096324","p95":"168089003.35199997"}},"inboundBitsRate":{"values":[[1673247564,"11814508.48"]],"analysis":{"avg":"18587597.36","max":"137528138.88","min":"3181142.88","p95":"49561521.447999954"}},"outboundBitsRate":{"values":[[1673247564,"84282965.52"]],"analysis":{"avg":"87557861.44","max":"290402258","min":"45337684.48","p95":"121041718.81199999"}},"internalBitsRate":{"values":[[1673247564,"9125.12"]],"analysis":{"avg":"278114.32","max":"2215460.48","min":"0","p95":"923494.5719999998"}},"throughBitsRate":{"values":[[1673247564,"694420.48"]],"analysis":{"avg":"5619235.12","max":"42455480.24","min":"262607.76","p95":"13559588.195999999"}},"other":{"values":[[1673247564,"0.00"]],"analysis":{"avg":"0.01","max":"0.08","min":"0.00","p95":"0.08"}}},{"type":"packets","totalPacketsRate":{"values":[[1673247564,"12077.53"]],"analysis":{"avg":"14062.37","max":"32840.42","min":"6564.17","p95":"20923.167999999987"}},"inboundPacketsRate":{"values":[[1673247564,"3865.58"]],"analysis":{"avg":"4241.61","max":"15460.03","min":"1918.22","p95":"8549.799999999997"}},"outboundPacketsRate":{"values":[[1673247564,"8118.89"]],"analysis":{"avg":"9170.98","max":"27134.58","min":"4510.25","p95":"13690.540999999996"}},"internalPacketsRate":{"values":[[1673247564,"15.89"]],"analysis":{"avg":"35.95","max":"276.47","min":"0.00","p95":"122.49749999999999"}},"throughPacketsRate":{"values":[[1673247564,"77.17"]],"analysis":{"avg":"613.82","max":"3768.56","min":"42.92","p95":"1279.757499999999"}},"other":{"values":[[1673247564,"0.00"]],"analysis":{"avg":"0","max":"0.01","min":"0.00","p95":"0.01"}}},{"type":"sessions","totalSessionsRate":{"values":[[1673247564,"29.92"]],"analysis":{"avg":"29.89","max":"29.92","min":"29.67","p95":"29.92"}}}]},"msg":"OK"}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,8 +1,10 @@
|
||||
export const mockData = {
|
||||
common: {
|
||||
status: 200,
|
||||
data: { status: 200, code: 200, queryKey: 'dec6723e173e8fa2b00917dc597bfb27', success: true, message: null, statistics: { elapsed: 0, rows_read: 2, result_size: 58, result_rows: 1 }, job: null, formatType: 'json', meta: [{ name: 'attack_event_count', type: 'long', category: 'Metric' }, { name: 'attacker_count', type: 'long', category: 'Metric' }, { name: 'victim_count', type: 'long', category: 'Metric' }], data: { resultType: 'object', result: [{ attackEventCount: 1200000, attackerCount: 2687878, victimCount: 36676767 }] }, originalUrl: 'http://192.168.44.55:9999?query=SELECT%20COUNT%28*%29%20AS%20attack_event_count%2C%20COUNT%28DISTINCT%28offender_ip%29%29%20AS%20attacker_count%2C%20COUNT%28DISTINCT%28victim_ip%29%29%20AS%20victim_count%20FROM%20security_event%20WHERE%20start_time%20%3E%3D%201675043912%20AND%20start_time%20%3C%201675047512%20AND%20security_type%20%3D%20%27ddos%27&format=json&option=real-time', msg: 'OK' }
|
||||
},
|
||||
empty: {
|
||||
status: 200,
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
@@ -14,6 +16,7 @@ export const mockData = {
|
||||
}
|
||||
},
|
||||
boundary: {
|
||||
status: 200,
|
||||
data: {
|
||||
status: 200,
|
||||
code: 200,
|
||||
|
||||
Reference in New Issue
Block a user