test(phase-0): 确认基线全绿并预置迭代验收测试契约
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 外观专利无侵权数据页(v1.3 AC-5)的挂载契约 —— Pending Phase 3。
|
||||
*
|
||||
* 用户拍板(2026-11-10):展示形式参照「去重数据库」页(DedupeRegistryPage 形态:自绘
|
||||
* `<table>` 行列表 + `OldPagination.vue` 分页,**不做卡片宫格**);`companyScoped: true`
|
||||
* 公司 Tab;任务号/ASIN/国家/起止时间筛选;`page`/`page_size` snake 参数,响应
|
||||
* `{items, total, page, pageSize}`。默认仅 super_admin 可见(菜单不预授权,判据在后端
|
||||
* AdminAppearancePatentCleanItemsControllerTest 的菜单迁移支,这里只管前端接线)。
|
||||
*
|
||||
* Phase 0 预置的判据(接缝名是判据的一部分,Phase 3 微调必须同步改本文件并登记蓝图 §5):
|
||||
* ① 页面组件落位 `src/pages/patent/AppearancePatentCleanItemsPage.vue`,且确实是
|
||||
* 自绘 table + OldPagination 的分页列表(不是卡片宫格);
|
||||
* ② routes.ts 注册 `patent-center/clean-items`(menuKey `admin_appearance_patent_clean_items`,
|
||||
* companyScoped: true),COMPANY_SCOPED_PAGES 同步登记(company-tab-wiring 护栏随注册自动覆盖);
|
||||
* ③ 挂载行为样本(激活时补齐):mock api 模块 → mount → 翻页/改每页条数、切公司 Tab 重取、
|
||||
* 任务号/ASIN/国家/起止时间筛选生效、空态与加载失败条。
|
||||
*
|
||||
* 跑法:`npx vitest run tests/mount/appearance-patent-clean-page.test.ts`
|
||||
*/
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { adminPages } from '@/router/routes'
|
||||
import { COMPANY_SCOPED_PAGES } from '@/config/company-scope'
|
||||
|
||||
const PAGE_PATH = 'src/pages/patent/AppearancePatentCleanItemsPage.vue'
|
||||
const MENU_KEY = 'admin_appearance_patent_clean_items'
|
||||
|
||||
describe.skip('Pending Phase 3: AC-5 外观专利无侵权数据页(分页列表,参照去重数据库页)', () => {
|
||||
it('页面组件落位且是自绘 table + OldPagination 的分页列表', () => {
|
||||
const src = readFileSync(fileURLToPath(new URL(`../../${PAGE_PATH}`, import.meta.url)), 'utf-8')
|
||||
expect(src).toContain('OldPagination')
|
||||
expect(src).toContain('<table')
|
||||
expect(src).not.toContain('el-card')
|
||||
})
|
||||
|
||||
it('路由与公司 Tab 注册齐备(companyScoped: true)', () => {
|
||||
const page = adminPages.find((p) => p.path === 'patent-center/clean-items')
|
||||
expect(page).toBeTruthy()
|
||||
expect(page?.menuKey).toBe(MENU_KEY)
|
||||
expect(page?.title).toBe('外观专利无侵权数据')
|
||||
expect(page?.companyScoped).toBe(true)
|
||||
const scoped = COMPANY_SCOPED_PAGES.find((p) => p.menuKey === MENU_KEY)
|
||||
expect(scoped).toBeTruthy()
|
||||
expect(scoped?.pageFiles).toContain(PAGE_PATH)
|
||||
})
|
||||
|
||||
it('挂载后走 snake 分页参数且切公司 Tab 重取(激活时用真组件挂载补齐)', async () => {
|
||||
// 页面组件 Phase 3 才落盘,vite 的 import-analysis 会在收集期解析动态导入 ⇒
|
||||
// 这里必须用运行期字符串 + @vite-ignore 推迟解析;skip 期间永不执行。
|
||||
const pageModule = '@/pages/patent/AppearancePatentCleanItemsPage.vue'
|
||||
// 激活时补齐:vi.mock('@/pages/patent/appearance-patent-clean-api.ts') →
|
||||
// const { default: Page } = await import(pageModule)
|
||||
// mount(Page, { global: { plugins: [createPinia()] } }) →
|
||||
// 断言首次请求 query 的 page/page_size(snake)与 {items,total,page,pageSize} 解包;
|
||||
// 改每页条数/翻页重发;companyTab.activeId 变化触发重取(护栏 company-tab-wiring 同口径)。
|
||||
const { default: Page } = await import(/* @vite-ignore */ pageModule)
|
||||
expect(Page).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user