fix(short-drama-agent-front): 修复测试警告与请求模拟
This commit is contained in:
1 parent
46f54548c7
commit
a9370cdf50
8 files changed
+67
-18
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import { generationProfile, imageCatalog } from '../../fixtures/generation'
|
||||
import { routerLinkStubs } from '../../fixtures/router'
|
||||
import { computed, ref } from 'vue'
|
||||
import { NImage, NRadioGroup, NScrollbar } from 'naive-ui'
|
||||
import { createMemoryHistory, createRouter, type RouteRecordRaw } from 'vue-router'
|
||||
import { DOMWrapper, flushPromises, mount, RouterLinkStub, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'
|
||||
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi, type Mock } from 'vitest'
|
||||
import CreateProjectDialog from '@/features/projects/components/CreateProjectDialog.vue'
|
||||
import BreakdownPage from '@/features/breakdown/BreakdownPage.vue'
|
||||
import CreateDramaPage from '@/features/create-drama/CreateDramaPage.vue'
|
||||
@@ -38,9 +39,6 @@ import { drawerPanel, expandSections, selectControl } from '@/testing/naive'
|
||||
import ProductionPage from '@/features/production/ProductionPage.vue'
|
||||
import { getProductionSession } from '@/features/production/model'
|
||||
|
||||
/** 单独挂载的页面和组件只替换导航链接,保留链接插槽和目标参数。 */
|
||||
const routerLinkStubs = { RouterLink: RouterLinkStub }
|
||||
|
||||
/**
|
||||
* 为内存路由补齐页面链接使用的正式项目工作区,避免链接解析时缺少目标路由。
|
||||
* @param routes 当前测试页面的入口路由
|
||||
@@ -259,13 +257,8 @@ async function mountSubjectImages() {
|
||||
await expandSections()
|
||||
}
|
||||
|
||||
/** 保留警告的原始输出,并在每例结束时检查页面挂载和清理过程是否出现警告。 */
|
||||
beforeEach(() => {
|
||||
vi.spyOn(console, 'warn')
|
||||
})
|
||||
|
||||
/** 释放页面与会话状态,并检查当前用例没有产生 Vue 或路由警告。 */
|
||||
afterEach(testContext => {
|
||||
/** 释放页面与会话状态;警告和未模拟请求由全局测试配置统一检查。 */
|
||||
afterEach(() => {
|
||||
getProductionSession(fixture.id).receipt = null
|
||||
getProductionSession(fixture.id).pipelineReceipt = null
|
||||
getIdentitySession(fixture.id).receipt = null
|
||||
@@ -278,7 +271,6 @@ afterEach(testContext => {
|
||||
getImageSession(fixture.id).receipt = null
|
||||
getImageSession(fixture.id).promptReceipt = null
|
||||
Object.assign(getOperation(fixture.id), { pending: false, label: '', error: '', notice: '', noticeType: null })
|
||||
testContext.expect(console.warn).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
describe('内容级滚动下的生产反馈', () => {
|
||||
|
||||
Reference in new issue
Block a user