import: ssw/dacli@eea0ebc (2026-08-12) 起点版本
本仓 2026-08-12 从 ssw main (192.168.1.18:13300/ssw/ssw-mvp) 的 dacli/ subpath 抽取,作为独立仓托管到 gitea:3000/ssw/dacli.git。 - 工作树为 ssw main dacli subpath 最新版 (110 commit, 08-12) - 历史未带 ssw main 整体历史(避免大仓污染) - 此为新仓基线 commit,未来以本仓历史为主
This commit is contained in:
commit
f403a7e80e
764 files changed
+132974
No files matched your search
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* defaultSortConfig.test.ts — 验证 create.ts 自动给 defaultSortConfig: []
|
||||
*
|
||||
* 回归测试 (v0.11, jxcj E2E 发现):
|
||||
* web ColumnDesign/src/helper/config.ts:122 定义 defaultSortConfig: []
|
||||
* dacli create.ts 之前写 {} 导致 JNPF 前端 TableList.vue .map() TypeError,
|
||||
* vxe-toolbar 渲染失败, "新增"按钮看不见 (BS-52 浏览器层假 PASS).
|
||||
*
|
||||
* 此测试覆盖:
|
||||
* 1. create.ts 源码里 defaultSortConfig 必须是 array [] (非 {} / null)
|
||||
* 2. 注释里必须出现 "修复" 字样说明 web 期望 array (防再回退到 {})
|
||||
*/
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const CREATE_TS = resolve(__dirname, '../../src/commands/form/create.ts')
|
||||
|
||||
function readCreate(): string {
|
||||
return readFileSync(CREATE_TS, 'utf-8')
|
||||
}
|
||||
|
||||
describe('form create columnData.defaultSortConfig (v0.11 jxcj E2E 闭环)', () => {
|
||||
it('create.ts 里 defaultSortConfig 必须是 [] (array), 不是 {}', () => {
|
||||
const src = readCreate()
|
||||
// 找 "defaultSortConfig:" 紧跟 4 行内的值定义
|
||||
const match = src.match(/defaultSortConfig:\s*(\[[^\]]*\]|\{[^}]*\})/)
|
||||
expect(match, 'create.ts 找不到 defaultSortConfig 字段').toBeTruthy()
|
||||
const val = match![1]
|
||||
expect(val.startsWith('['), `defaultSortConfig 应是 array [] 开头, 实际是: ${val.slice(0, 40)}`).toBe(true)
|
||||
expect(val.endsWith(']'), `defaultSortConfig 应是 array [] 结尾, 实际是: ${val.slice(-40)}`).toBe(true)
|
||||
// 显式禁止 {}
|
||||
expect(val, 'defaultSortConfig 不应是 {} object').not.toBe('{}')
|
||||
})
|
||||
|
||||
it('create.ts 修复注释必须引用 web 源码定位 (config.ts:122)', () => {
|
||||
const src = readCreate()
|
||||
// 找 defaultSortConfig 上面 10 行内必须有 "config.ts:122" 引用
|
||||
const idx = src.indexOf('defaultSortConfig:')
|
||||
expect(idx, 'create.ts 找不到 defaultSortConfig: 字段').toBeGreaterThan(0)
|
||||
const before = src.slice(Math.max(0, idx - 800), idx)
|
||||
expect(before).toMatch(/config\.ts:122/)
|
||||
})
|
||||
|
||||
it('create.ts 修复注释必须说明 web 期望 array (防止再退回 {})', () => {
|
||||
const src = readCreate()
|
||||
const idx = src.indexOf('defaultSortConfig:')
|
||||
const before = src.slice(Math.max(0, idx - 800), idx)
|
||||
expect(before.toLowerCase()).toMatch(/array/)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user