CN-866 feat: 单测用例--network overview ddos检测图 编写单测用例

This commit is contained in:
@changcode
2023-01-29 16:04:01 +08:00
parent 4655eed55f
commit e9edd9cf05
4 changed files with 55 additions and 23 deletions

View File

@@ -13,6 +13,8 @@ dayjs.extend(timezone)
dayjs.extend(advancedFormat)
dayjs.extend(weekday)
window.$dayJs = dayjs
// 引入 lodash 工具 模拟 lodash
const _ = require('lodash') // lodash工具
/* 模拟vue-router库否则组件中引用vue-router的代码报错 */
jest.mock('vue-router', () => {
@@ -33,5 +35,7 @@ jest.mock('@/indexedDB')
config.global.mocks.$t = key => key
/* 模拟$route具体用例中需要不同值时重写覆盖即可 */
config.global.mocks.$route = { query: '' }
/* 模拟 lodash */
config.global.mocks.$_ = _
/* 消除warn */
jest.spyOn(console, 'warn').mockImplementation(() => {})