Files
crawler-plugin/admin-frontend-vue/tests/company-tab-wiring.test.ts
T
huangzd1997 db91394837 feat(公司tab): 店铺管理与数据权限分组按成员集筛, 凭据按 id 补读闸门
Task 11: ShopManageController.page / listGroups 接 DataReadScope.readScope,
把 company_id 算出的成员集当参数传给 service(controller 层收口, service 手上
只有 operatorId+布尔); ShopManageGroupService.list 增加 companyMemberIds 腿。

凭据 getCredentialById 的闸门用与 page() 同形的尺子(created_by_id IN creators
OR group_id IN groups),不是账号集合 —— 后者表达不了分组那一腿, 会把列表看得见
的行读凭据时 403 掉, 那是把正当访问静默删掉。

新增 testutil/SourceScan 供源码扫描式护栏取文(找不到方法必须抛, 不许返回空串恒绿)。

前端两页接 tab: companyId 取 companyTab.requestCompanyId, 并 watch activeId 重载;
G1 登记表给 admin_shop_manage 钉两条发送点(白名单 builder 故意不收 companyId)。
写侧入口一律不收 company_id, 由 ShopManageServiceTest 逐方法反向钉住。
2026-10-05 16:25:24 +08:00

316 lines
22 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test'
import assert from 'node:assert/strict'
import { existsSync, readFileSync, readdirSync } from 'node:fs'
import { readSource } from './helpers.ts'
import { adminPages } from '../src/router/routes.ts'
import { COMPANY_SCOPED_PAGES, SUPER_ADMIN_ONLY_MENU_KEYS } from '../src/config/company-scope.ts'
const read = (p: string) => {
assert.ok(existsSync(p), `护栏读不到 ${p}:api 文件改名了,清单必须同步(别把用例改成"不存在就跳过")`)
// 与 helpers.readSource 同口径归一行尾(CRLF 检出树会把有界窗口判据挤红,见 helpers 里的注释)。
return readFileSync(p, 'utf8').replace(/\r\n/g, '\n')
}
/**
* 取值口登记表(2026-10-05 修复轮 1,复评 I-2)。上面那条正向判据原本只问「有没有把 company_id 当成查询
* 参数下传」,`/company_id\s*[:=]/` 对**右半边从哪儿取值**是瞎的:评审把
* `history-api.ts` 的 `query.company_id = params.companyId` 改成 `= normalized.companyId` 之后,
* 缺口清单与 baseline **逐字相同**(`admin_history` 都不出现)、`vue-tsc` 也不红
* (`normalizeHistoryParams` 的返回类型就是 `HistoryListParams`,本轮刚给它加了 `companyId?: number | null`,
* 所以 `normalized.companyId` 类型合法、运行时恒 `undefined`)。tab 画了、请求发了、参数没有——
* 这正是本批次要杀的那类静默失效,尺子却看不见。
* <p>于是每页登记一条"company_id 右侧的根标识符**必须**是该页 api 函数自己的入参"的形状:
* `shape` 为 `RegExp` 时,对**剥完注释的源码**求值,不匹配即红并点名文件;`shape` 为 `null` 是
* "这一页还没接线"的显式声明(今天 6 页如此,它们本来就在缺口清单里)。
* <p>两道不留缝:① `COMPANY_SCOPED_PAGES` 里每一页都必须在表里有条目,缺条目直接红;
* ② 一旦某个文件真的出现了 `company_id` 下传而它的 `shape` 还是 `null`,同样红——
* 所以"新页接线时顺手不改登记表"过不去,也**没有**"没登记就退回宽松判据"的默认分支。
*/
type CompanyIdPin = { readonly file: string; readonly shape: RegExp | null; readonly note: string }
const COMPANY_ID_SOURCE_PINS: Readonly<Record<string, readonly CompanyIdPin[]>> = {
admin_history: [
{
file: 'src/pages/records/history-api.ts',
// fetchHistoryList(params: Partial<HistoryListParams>):唯一入参对象是 params(history-api.ts:15 的形状)。
shape: /company_id\s*=\s*params\.companyId\b/,
note: 'normalizeHistoryParams 是白名单构造(只点名 page/pageSize/userId/timeStart/timeEnd),从 normalized 读 companyId 恒 undefined',
},
],
admin_image_video_tasks: [
{
file: 'src/pages/tasks/image-video-api.ts',
// fetchImageVideoTasks(filter, page, pageSize, companyId):公司值的入参就是第 4 个形参本身(:19 的形状),
// 不是 filter 的字段——toImageVideoQuery 同样是白名单构造。
shape: /company_id\s*=\s*companyId\b/,
note: 'filter 走 toImageVideoQuery 白名单构造,公司值只能落在 companyId 形参上',
},
],
admin_task_center: [
{ file: 'src/api/task-center.ts', shape: null, note: 'Task 10 未接线(已在缺口清单里);谁接线谁把 null 换成本函数真实取值口' },
{ file: 'src/pages/task-center/task-center-model.ts', shape: null, note: '同上:这一页有两个取数模块,两个都得登记' },
],
admin_user_secret_usage: [
{
file: 'src/api/user-secret-usage.ts',
// fetchUserSecretUsage(params: UserSecretUsageQuery):唯一入参对象是 params(形参表即形状来源,不写行号——api 文件一改就漂)。
shape: /company_id\s*=\s*params\.companyId\b/,
note: 'query 由本函数自己从零构造,companyId 只能取自 params;api 模块不碰 Pinia store(node --test 直接 import 会抛 no active pinia)',
},
],
admin_user_secrets: [
{
file: 'src/api/user-secrets.ts',
// fetchUserSecretList(params: UserSecretQuery):唯一入参对象是 params(同上,不写行号)。
shape: /company_id\s*=\s*params\.companyId\b/,
note: '同上:值由 UserSecretsPage.vue 传 companyTab.requestCompanyId,api 里不读任何归一化/构造出来的中间对象',
},
],
admin_device_logs: [
{ file: 'src/api/device-logs.ts', shape: null, note: 'Task 12 未接线(已在缺口清单里)' },
],
admin_group_manage: [
{
file: 'src/pages/account/shop-group-api.ts',
// fetchShopGroups(companyId?: number | null):唯一发送口,右侧必须是它自己的形参。
shape: /company_id\s*:\s*companyId\b/,
note: 'null 由 axios 跳过 ⇒ 非超管不发 company_id,后端按会话裁剪',
},
],
admin_shop_manage: [
{
file: 'src/pages/shop/shop-manage-api.ts',
// fetchShopManageList(params):toShopManagePageQuery 是白名单构造 ⇒ 公司值只许从原始 params 读。
shape: /company_id\s*=\s*params\.companyId\b/,
note: '写成 normalized.companyId 会 TS 绿、运行时恒 undefined(Task 8 复评 I-2 那个洞)',
},
{
file: 'src/pages/shop/shop-manage-api.ts',
// 第二个发送口 fetchShopManageGroups(companyId):同一个 GET /groups,与分组管理页共用这一形。
// 两条各管一处取值口,不许合成一条 alternation —— 那等于把判据放松回「文件里出现过就行」。
shape: /company_id\s*:\s*companyId\b/,
note: '列表窄了而下拉不窄 = 两页口径对不上,且下拉能选到别家的组',
},
],
}
/** 严格判据的分母由本轮实扫得出(修完不许恒绿也不许恒红):求值了几条 shape、其中几条通过。 */
let strictPinsEvaluated = 0
let strictPinsPassed = 0
test('正向:声明 companyScoped 的页,其 api 文件必须真的带 company_id,页面组件必须 watch activeId', () => {
// 循环里**收集**、循环后一次性断言:Task 8-12 是 5 个任务共用这把尺子,fail-fast 时做完自己那页的同事
// 仍然只看到一句指向**别人页**的红(今天只报 src/api/task-center.ts),判断不出本页是否已收敛。
// 这条不改变"Task 12 之前必红"的既定性质,只是让尺子可诊断——红消息里 8 页缺口逐页列全。
const problems: string[] = []
for (const page of COMPANY_SCOPED_PAGES) {
const gaps: string[] = []
if (!adminPages.some((p) => p.menuKey === page.menuKey && p.companyScoped)) {
gaps.push('注册表里这一页没声明 companyScoped:清单与注册表两处口径打架')
}
for (const file of page.apiFiles) {
// 只认「当成了查询参数」那一形(`company_id:` / `company_id =`),不再认裸 token:
// 旧式 /company_id|companyId/ 接近恒真,Task 8-12 只要写一行 `const companyId = null`
// 或一句「// 由 companyId 决定」就能把这页判成已接线,而实际什么都没下传(约束 6:注释不算)。
// 读之前先 stripComments,与反向那半支同口径——说明注释里的 company_id 不是接线。
if (!/company_id\s*[:=]/.test(stripComments(read(file)))) {
gaps.push(`${file} 没把 company_id 当成查询参数下传`)
}
}
// 取值口登记(复评 I-2):光"把 company_id 塞进查询对象"不够,右半边必须取自**本函数自己的入参**。
for (const pin of COMPANY_ID_SOURCE_PINS[page.menuKey] ?? []) {
if (!page.apiFiles.includes(pin.file)) {
gaps.push(`${pin.file} 登记在 ${page.menuKey} 名下,但 COMPANY_SCOPED_PAGES 的 apiFiles 里没有它:登记表与清单两处口径打架`)
continue
}
const src = stripComments(read(pin.file))
const wired = /company_id\s*[:=]/.test(src)
if (pin.shape === null) {
// 没登记取值口却已经下传了参数 = 这一页的取值口径没人看守(洞就是这么留下的)。
if (wired) gaps.push(`${pin.file} 已经把 company_id 当下传参数了,登记表里 shape 却还是 null —— 把它换成"company_id 右侧 = 本函数入参"的正则`)
continue
}
strictPinsEvaluated++
if (!wired) {
gaps.push(`${pin.file} 登记了取值口 ${pin.shape},文件里却一个 company_id 都没下传:登记表与代码漂移(要么接线回来,要么把 shape 改回 null)`)
continue
}
if (!pin.shape.test(src)) {
gaps.push(`${pin.file} 的 company_id 右半边不是本函数入参(登记表要求 ${pin.shape};${pin.note})`
+ '—— tab 画了、请求发了、参数没有;编译器不一定看得见(normalizeHistoryParams 的返回类型里就有这个字段)')
continue
}
strictPinsPassed++
}
for (const file of page.pageFiles) {
// 与 api 侧同口径先剥注释(约束 6:注释里出现字面量不算接线)——否则一句
// `// 这里读 companyTab.requestCompanyId` 就能同时骗过下面两条断言。
// 残留面已封:stripComments 现在 JS 的 `//`、`/* */` 与 Vue 模板的 `<!-- -->` 三类都剥。
const source = stripComments(read(file))
if (!/watch\(\(\)\s*=>\s*companyTab\.activeId/.test(source)) {
gaps.push(`${file} 没监听公司 tab:切 tab 不重取数 = 这页的 tab 是装饰品`)
}
// brief Interfaces 明定的唯一取值出口:页面取公司值一律写 companyTab.requestCompanyId。
// 裸调 companyIdForRequest 是纯函数、签名要两个入参,不满足这条 ⇒ 顺带封死第三处取值口径。
if (!/companyTab\.requestCompanyId/.test(source)) {
gaps.push(`${file} 没读 companyTab.requestCompanyId(页面取公司值的唯一出口)`)
}
}
// 覆盖性自检:清单里每一页都必须在登记表里有条目。**没有**"没登记就退回宽松判据"这条路。
if (!(page.menuKey in COMPANY_ID_SOURCE_PINS)) {
gaps.push(`${page.menuKey} 在 COMPANY_ID_SOURCE_PINS 里没有条目:接线的页必须登记取值口,护栏不许留默认分支`)
}
if (gaps.length) problems.push(`${page.menuKey}:${gaps.join(';')}`)
}
// 正样本自检:求值了却一条都没通过 ⇒ 严格判据恒红(或形状不认),红在缺口清单里、不抢本页的诊断信息。
if (strictPinsEvaluated > 0 && strictPinsPassed === 0) {
problems.push(`(取值口取样自检)shape 求值了 ${strictPinsEvaluated} 条、通过 0 条 —— 判据恒红或形状不认,不可信`)
}
// 严格半支的取样自检:登记表是空的、或一页都没走完 shape 求值 ⇒ 这半支等于没写,用例自己红。
assert.ok(strictPinsEvaluated >= 2,
`取值口严格判据本轮只求值了 ${strictPinsEvaluated} 条(登记表里 admin_history / admin_image_video_tasks 两条 shape 都在,`
+ `求值数不可能低于已接线页数)——判据空转,normalized-vs-params 那个洞又没人看守了`)
assert.ok(COMPANY_ID_SOURCE_PINS.admin_history.some((p) => p.shape !== null)
&& COMPANY_ID_SOURCE_PINS.admin_image_video_tasks.some((p) => p.shape !== null),
'Task 8 已接线的两页在登记表里的 shape 被改回 null 了:严格判据对这两页不再起作用(正样本归零)')
assert.deepEqual(problems, [],
`公司 tab 接线缺口(逐页列全;Task 8-12 补齐后这支自动收敛,本轮刻意留红):\n`
+ problems.map((p) => ` - ${p}`).join('\n'))
})
test('反向:把 company_id 当查询参数用的取数模块必须被清单认领(防止"筛了但没人知道这页参与")', () => {
const claimed = new Set(COMPANY_SCOPED_PAGES.flatMap((p) => p.apiFiles))
const scanned = requestModules()
// 取样自检:扫描本身失效(目录改名/递归参数写错)时下面这支会"零文件 ⇒ 恒绿"。
assert.ok(scanned.length >= 35, `只扫到 ${scanned.length} 个取数模块,requestModules 八成是坏了`)
for (const file of scanned) {
if (claimed.has(file)) continue
const text = stripComments(readFileSync(file, 'utf8'))
assert.equal(/['"]company_id['"]|\bcompany_id\s*[:=]/.test(text), false,
`${file} 自己塞了 company_id 参数但没进 COMPANY_SCOPED_PAGES——它绕过了唯一清单`)
}
})
test('两张清单不许重叠:超管专属页不可能同时是按公司看数据的页', () => {
const scoped = new Set(COMPANY_SCOPED_PAGES.map((p) => p.menuKey))
for (const key of SUPER_ADMIN_ONLY_MENU_KEYS) assert.equal(scoped.has(key), false)
})
/** 分母 = **会把 company_id 发出去的模块**:`src/api` 下的 .ts 与 `src/pages` 下名字以 `-api.ts` 结尾的模块,实测 40 个。
* 不是"所有 .ts"(135 个):查询对象的**类型**声明住在 `history-dto.ts`、`image-video-filter.ts`、`shop-dto.ts`
* 这些兄弟模块里(Task 8/10/11 要给它们加 `company_id?: number`),类型行本身长得像"用了 company_id",
* 拿全量 .ts 当分母会让反向用例红在一行类型声明上,而那一行本来就该存在。 */
function requestModules(): string[] {
return ['src/api', 'src/pages'].flatMap(listTs)
.filter((f) => f.startsWith('src/api/') || f.endsWith('-api.ts'))
}
function listTs(dir: string): string[] {
// Node 24 的 readdirSync 支持 recursive + withFileTypes;parentPath 是新字段,path 是旧字段,两个都要兜。
// Windows 上递归结果的 parentPath 带反斜杠(`src\pages\shop\shop-manage-api.ts`),不转正斜杠就永远匹配不上 claimed。
return readdirSync(dir, { withFileTypes: true, recursive: true })
.filter((e) => e.isFile() && e.name.endsWith('.ts'))
.map((e) => `${(e as { parentPath?: string }).parentPath ?? e.path}/${e.name}`.split(/[\\/]+/).join('/'))
}
// 去掉注释再匹配:**这是这支用例能不能用的关键**。
// 举证口径(2026-10-05 修复轮 1 复核,原举证已失效):分母 = src/api/**.ts + src/pages/**-api.ts,
// 取样集内当前 `company_id` 命中为 **0** ⇒ 这个 helper 今天是惰性的。它防的是 **Task 8-12 写进取样集的
// 说明注释**——那批接线会在这些 api/取数模块里留下「company_id 由公司 tab 决定」之类的散文,
// 不剥注释,反向用例就会红在一条**说明为什么不传参**的注释上,然后下一个人把它写成行级临时豁免,整支用例就废了。
// (旧举证引的 src/pages/account/user-create-model.ts 既不在 src/api/ 下也不以 -api.ts 结尾,
// 根本不在分母里,行号也已漂动——别再照那句话去改那个文件。)
// 剥注释的写法要连 `//` 行注释一起剥,但**不许**顺手放宽成"整文件不匹配"。
// 正向那半支的 api 侧与 page 侧都走它:注释里的 company_id / companyTab.requestCompanyId 都不算接线。
// (这一段用 `//` 而不是 `/** */`:brief 原文里的示例正则 `if (!/^\s*\*/.test(line))` 含 `*/`,
// 放进块注释会把注释当场截断,node 的 TS 解析器随即报 ERR_INVALID_TYPESCRIPT_SYNTAX——整支用例加载都失败。)
function stripComments(source: string): string {
return source
// Vue 模板的 <!-- --> 也要剥:pageFiles 取样全是 .sfc.vue,一句 `<!-- watch(() => companyTab.activeId) -->`
// 在只剥 JS 注释时能同时骗过 page 侧两条钉子(2026-10-05 复评 (a))。
.replace(/<!--[\s\S]*?-->/g, '')
.replace(/\/\*[\s\S]*?\*\//g, '')
.split(/\r?\n/)
.filter((line) => !line.trimStart().startsWith('//'))
.join('\n')
}
/** 从 routes.ts 逐行解析 `menuKey` → `load: () => import('@/pages/…')` 的目标文件(相对工程根的正斜杠路径)。
* 注册表今天是「一页一行」的字面量数组,所以按行取;解析不出来由用例判红,不静默放行。 */
function loadSpecByMenuKey(): Map<string, string> {
const map = new Map<string, string>()
for (const line of readSource('src/router/routes.ts').split(/\r?\n/)) {
const menuKey = /menuKey:\s*'([^']+)'/.exec(line)?.[1]
const spec = /load:\s*\(\)\s*=>\s*import\(['"]@\/([^'"]+)['"]\)/.exec(line)?.[1]
if (menuKey && spec) map.set(menuKey, `src/${spec}`)
}
return map
}
test('清单的 pageFiles 必须就是注册表里同页的 load 组件:改名或挪目录时这支要红,不能让 tab 静默指向不存在的页', () => {
const loads = loadSpecByMenuKey()
assert.ok(loads.size >= 20, `只从 routes.ts 解析出 ${loads.size} 条 load,解析式八成是坏了`)
for (const page of COMPANY_SCOPED_PAGES) {
const target = loads.get(page.menuKey)
assert.ok(target, `${page.menuKey} 在注册表里没解析出 load 组件:routes.ts 的写法变了,分母不能静默放行`)
assert.ok(page.pageFiles.includes(target),
`${page.menuKey} 的路由组件是 ${target},清单 pageFiles 却列了别处——护栏盯的就不是这页真正渲染的那个文件`)
for (const file of [...page.pageFiles, ...page.apiFiles]) {
assert.ok(existsSync(file), `${page.menuKey} 的清单指向不存在的文件:${file}`)
}
}
})
test('跨端常量钉子:后端 SUPER_ADMIN_ONLY_KEYS 与前端 SUPER_ADMIN_ONLY_MENU_KEYS 由代码执行地逐字相等', () => {
// Task 4 的出口 1/2/3 全靠后端那份 Set,前端侧边栏/守卫靠这份数组,两份各写各的迟早漂移。
// readSource 以 admin-frontend-vue 为根,'../backend-java/…' 落在大仓里(先例:tests/align-menu-auto-key.test.ts:36)。
// 判红口径:读不到文件(readSource 直接抛)/ 抽不到常量 / 取样集为空,三种都算红,不许"文件不存在就跳过"。
const java = readSource('../backend-java/src/main/java/com/nanri/aiimage/modules/permission/service/PermissionMenuService.java')
const def = /SUPER_ADMIN_ONLY_KEYS\s*=\s*Set\.of\(([^)]*)\)/.exec(java)
assert.ok(def, '没从 PermissionMenuService.java 抽到 SUPER_ADMIN_ONLY_KEYS = Set.of(…) 这一句:后端换了写法就得同步这份钉子')
const backend = [...def[1].matchAll(/"([^"]+)"/g)].map((m) => m[1])
assert.ok(backend.length >= 1, '后端那份常量取样为空(Set.of() 空集 = 闸门没写)')
assert.ok(SUPER_ADMIN_ONLY_MENU_KEYS.length >= 1, '前端名单为空 = 这道闸门等于没写')
assert.deepEqual([...backend].sort(), [...SUPER_ADMIN_ONLY_MENU_KEYS].sort(),
'超管专属菜单两份名单不等值:后端摘掉的那项前端仍会显示(或反之),§8.1 的口径就分成两处')
})
test('挂载与单一尺子:tab 条挂在壳层、公司名读 companyName、「该不该画」只住 store 一处', () => {
const layout = readSource('src/layout/AdminLayout.vue')
assert.ok(layout.includes(`import CompanyTabs from '@/layout/CompanyTabs.vue'`), '壳层没 import CompanyTabs')
assert.ok(layout.includes('<CompanyTabs />'), '壳层没挂 <CompanyTabs />')
// 钉**模板里的挂载点**而不是 import 行:只写 layout.includes('OperationGuide') 时,删掉 <OperationGuide />
// 而留着那行 import 照样绿——一条"声称保护而不保护"的断言比没有更危险(后续评审会拿它当已核事实)。
assert.ok(layout.includes('<OperationGuide />'), '挂 tab 时不许把 OperationGuide 摘掉(align_guide_component_in_layout_headline 钉着)')
const tabs = readSource('src/layout/CompanyTabs.vue')
assert.ok(tabs.length > 0, '取样集非空自检:CompanyTabs.vue 读到了')
assert.ok(tabs.includes('item.companyName'), 'CompanyTabs 的标签文本必须读 companyName(CompanyItem 没有 name 字段)')
// 排他断言:\bitem\.name\b 不匹配 item.companyName,写错字段名只会渲染出空白 tab,不会编译报错。
assert.equal(/item\.name\b/.test(tabs), false, '不许写 item.name:模板属性访问不受 vue-tsc 约束,只会静默渲染空白 tab')
// 「该不该画 tab 条」只许有一把尺子(store 的 visibleForOperator):组件里再数一遍 length 就是第二把。
assert.ok(tabs.includes('tab.visibleForOperator'), '组件的 show 必须直接抄 store 的 visibleForOperator')
assert.equal(tabs.includes('length > 1'), false, '组件里不许再数一遍 length——停用一家时与 store 的口径会差 1')
const store = readSource('src/stores/company-tab.ts')
assert.ok(store.includes('visibleForOperator(): boolean'), 'store 缺 visibleForOperator')
assert.match(store, /visibleForOperator\(\)[\s\S]{0,160}isSuperAdmin/, 'visibleForOperator 必须含 isSuperAdmin 判定')
assert.match(store, /visibleForOperator\(\)[\s\S]{0,160}this\.loaded/, 'visibleForOperator 必须含 loaded 判定,免得先闪出空 tab')
// 第三把条件不是新尺子:activeId 由 firstSelectableCompanyId 算,它本身就是「存在至少一家启用公司」。
// 少了它,两家全停用时 companies.length > 1 照样成立 ⇒ 画出一条容器在、按钮为零的空 tab 条。
assert.match(store, /visibleForOperator\(\)[\s\S]{0,260}this\.activeId !== null/,
'visibleForOperator 必须含「有可选公司」判定,全是停用公司时 tab 条整体不渲染')
assert.match(store, /requestCompanyId\(\)[\s\S]{0,120}companyIdForRequest/,
'requestCompanyId 必须是 companyIdForRequest 的唯一出口(页面只读这个 getter)')
// 失败路径也要有钉子(2026-10-05 复评 (c)):改前 `initialize` 只有 try/finally ⇒ GET /companies 抛错时
// loaded 永远 false、tab 条静默消失、异常落 unhandled rejection(全仓 src 无 errorHandler 兜底)。
// 只补代码不补钉子的话,Task 8-12 里谁把它改回 try/finally,1726 支用例一支都不会红——那是"修好了但没护栏"。
assert.match(store, /catch \(error\)[\s\S]{0,420}this\.error =[\s\S]{0,120}throw error/,
'initialize 必须 catch 出 error 状态再 rethrow(口径照 admin-session.ts:37-39),不许退回只有 try/finally')
// error 只许住 store 与 console:一旦进模板就是§12 第 5 条没批的那一处新界面暴露。
assert.equal(tabs.includes('tab.error'), false, '不许把 error 渲染进模板:提示条/文案都不在已批的两处暴露里')
assert.match(tabs, /initialize\(\)\.catch\(/,
'组件侧必须 .catch 接住 store 的 rethrow,否则又变回 unhandled rejection')
})