fix(short-drama-agent-front): 修复测试警告与请求模拟

This commit is contained in:
GJ committed 2026-10-15 18:10:19 +08:00
1 parent 46f54548c7
commit a9370cdf50
8 files changed
+67 -18

No files matched your search

+5 -1
View File
@@ -1,4 +1,5 @@
import { h } from 'vue'
import { routerLinkStubs } from '../../fixtures/router'
import { mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi } from 'vitest'
import {
@@ -280,7 +281,10 @@ describe('全站平面主题', () => {
it('风格参考图页内只保留添加入口,缩略图在宽屏下保持紧凑', () => {
const css = readAllStyles()
wrapper = mount(StyleImages, { props: { projectId: 'theme-test-project', images: [], disabled: false } })
wrapper = mount(StyleImages, {
global: { stubs: routerLinkStubs },
props: { projectId: 'theme-test-project', images: [], disabled: false }
})
expect(wrapper.find('form').exists()).toBe(false)
expect(wrapper.findAll('button').map(button => button.text())).toEqual(['从资产库添加', '通过链接添加'])
expect(css).toMatch(
+6 -1
View File
@@ -1,4 +1,5 @@
import { imageCatalog, generationProfile } from '../../fixtures/generation'
import { routerLinkStubs } from '../../fixtures/router'
import { defineComponent, h, reactive } from 'vue'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi } from 'vitest'
@@ -99,7 +100,8 @@ describe('统一的 Naive UI 表单校验', () => {
title: '雨夜来信标题',
topic: '雨夜来信',
style: '',
episodeCount: 3
/** 与后端 Auto 时长预算契约一致,不再发送旧的顶层集数。 */
durationBudget: { mode: 'auto', episodeCount: 3 }
})
expect(wrapper.emitted('created')).toEqual([['created', 'create-execution-1']])
})
@@ -147,6 +149,7 @@ describe('统一的 Naive UI 表单校验', () => {
it('登记参考图拦截非法地址和小数排序,允许有效存储地址与负整数排序', async () => {
wrapper = mount(StyleImages, {
attachTo: document.body,
global: { stubs: routerLinkStubs },
props: { projectId: 'form-test-project', images: [], disabled: false }
})
expect(document.querySelector('[aria-label="风格图片地址"]')).toBeNull()
@@ -191,6 +194,7 @@ describe('统一的 Naive UI 表单校验', () => {
vi.stubGlobal('fetch', fetcher)
wrapper = mount(StyleImages, {
attachTo: document.body,
global: { stubs: routerLinkStubs },
props: { projectId: 'form-test-project', images: [], disabled: false }
})
@@ -227,6 +231,7 @@ describe('统一的 Naive UI 表单校验', () => {
vi.stubGlobal('fetch', fetcher)
wrapper = mount(StyleImages, {
attachTo: document.body,
global: { stubs: routerLinkStubs },
props: { projectId: 'form-test-project', images: [], disabled: true, hasStyle: false }
})
expect(wrapper.text()).toContain('先保存视觉风格')