fix(tests): P2 — test tsc errors 18→0 (tsc now fully 0/51)

- 4 AppContext fixtures (blindspot_guards/bs54_guard/dbLinkId/verify_option):
  add topLevelMenus:[] + currentSystemId:'' (fields added in BS-109, fixtures drifted)
- CreateOpts: add internal __aiBuildFormData?:{formData} hook (was (opts as any));
  fixes 3 form_create_smartprops_ai.test.ts errors
- e2e/_helpers/nav.ts: /// <reference lib=dom /> for page.evaluate browser context
  (resolves document/HTMLElement + item/e unknown)
- bs66-70 test: type formVm as Set<string>
- auto_fix.test: gX1!.candidates!  ; defhttp test: HeadersInit → Record<string,string>
- output_filter.test: cast stdout spy to declared MockInstance type

Verified: tsc 0 errors; vitest unit 361 pass / 19 fail == pre-existing
(blindspot_guards registry drift + doc-md-slice fixture, audit §12.2) — no regression.

Co-Authored-By: Claude <[email protected]>
This commit is contained in:
sswandClaude committed 2026-07-24 09:47:46 +08:00
1 parent e4b9ffa471
commit 6210a273c6
10 files changed
+16 -5

No files matched your search

+2
View File
@@ -71,6 +71,8 @@ interface CreateOpts {
ai?: string
/** columnList 命名规范: auto | snake | f_prefix (默认 snake). 见 --column-naming 选项 (create.ts:315) */
columnNaming?: string
/** internal: AI/table 分支构建好的 formData 缓存, 供后续 smartProps/持久化复用 (非 CLI 选项) */
__aiBuildFormData?: { formData: string }
/** 5.10.2 AI 推荐字段 — 自然语言描述, 平台 LLM 推荐单字段, 不建表单 */
aiField?: string
// 历史 --ai-json 已删 (跟 --ai 路径重复, 避免两条相似代码路径漂移)
+1
View File
@@ -1,3 +1,4 @@
/// <reference lib="dom" />
/**
* _helpers/nav.ts — 侧边栏菜单导航
*
@@ -48,7 +48,7 @@ function checkFieldRegList(fields: any[]): Array<{field:string,label:string,expe
function checkColumnListConsistency(formData: any): Array<{bs:string, msg:string, details:string[]}> {
const issues: Array<{bs:string, msg:string, details:string[]}> = []
const fields = formData.fields || []
const formVm = new Set(fields.map((f: any) => f.__vModel__).filter(Boolean))
const formVm = new Set<string>(fields.map((f: any) => f.__vModel__).filter(Boolean))
let columnList: any[] = []
if (typeof formData.columnData === 'string') {
try { columnList = JSON.parse(formData.columnData).columnList || [] } catch { /* */ }
+2 -2
View File
@@ -150,8 +150,8 @@ describe('G-X1 BS-47 重名 suggest', () => {
)
const gX1 = result.suggestions.find((s) => s.id === 'G-X1')
expect(gX1).toBeDefined()
expect(gX1!.candidates.length).toBeGreaterThanOrEqual(1)
expect(gX1!.candidates).toContain('shared')
expect(gX1!.candidates!.length).toBeGreaterThanOrEqual(1)
expect(gX1!.candidates!).toContain('shared')
})
it('无冲突时不触发 G-X1 (workflows 空也不误判)', () => {
+2
View File
@@ -21,6 +21,8 @@ const baseCtx: AppContext = {
releasedForms: ['form_leaveApply', 'form_project', 'form_tds_leave'],
modifiedAfterPublishForms: [],
workflowList: [],
topLevelMenus: [],
currentSystemId: '',
existingTables: ['tds_leave', 'tds_project'],
menus: ['leaveApply', 'project'],
currentVersion: 'v0.9',
+2
View File
@@ -30,6 +30,8 @@ const baseCtx: AppContext = {
releasedForms: ['test_form'],
modifiedAfterPublishForms: [],
workflowList: [],
topLevelMenus: [],
currentSystemId: '',
existingTables: ['test_table'],
menus: ['test_form'],
currentVersion: 'v0.10',
+2
View File
@@ -26,6 +26,8 @@ const baseCtx: AppContext = {
releasedForms: [],
modifiedAfterPublishForms: [],
workflowList: [],
topLevelMenus: [],
currentSystemId: '',
existingTables: [],
menus: [],
currentVersion: '0.11',
+1 -1
View File
@@ -46,7 +46,7 @@ function makeClient(): JnpfClient {
}
// 用 vi.fn 替换 fetch, 每次 stub 行为的 httpStatus / body
function installFetchStub(httpStatus: number, bodyText: string, headers?: HeadersInit): ReturnType<typeof vi.fn> {
function installFetchStub(httpStatus: number, bodyText: string, headers?: Record<string, string>): ReturnType<typeof vi.fn> {
return vi.fn(async (url: string, init?: RequestInit) => {
const method = init?.method || 'GET'
let body: unknown = null
+1 -1
View File
@@ -370,7 +370,7 @@ describe('log.printRawTable — 表格输出 primitive (P4 v2 2026-07-21)', () =
beforeEach(() => {
stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(((_s: string) => {
// no-op
}) as never)
}) as never) as ReturnType<typeof vi.spyOn>
})
afterEach(() => {
+2
View File
@@ -25,6 +25,8 @@ const baseCtx: AppContext = {
releasedForms: ['form_jxcj_competition_info', 'form_jxcj_athlete'],
modifiedAfterPublishForms: [],
workflowList: [],
topLevelMenus: [],
currentSystemId: '',
existingTables: ['jxcj_competition_info'],
menus: ['jxcj_competition_info'],
currentVersion: 'v0.10',