feat(jd): 类目筛选改京麦同款级联面板(一/二级静态导航+末级全集搜索点选)
This commit is contained in:
@@ -23,6 +23,10 @@ import {
|
||||
createJdProductFilterState,
|
||||
toJdProductListParams,
|
||||
} from '../src/pages/jd/jd-product-filter.ts'
|
||||
import {
|
||||
jdCategoryNavChildren,
|
||||
jdCategoryNavRoots,
|
||||
} from '../src/pages/jd/jd-category-tree.ts'
|
||||
import {
|
||||
jdPriceRange,
|
||||
parseJdProductDetail,
|
||||
@@ -30,6 +34,21 @@ import {
|
||||
toJdProductItem,
|
||||
} from '../src/pages/jd/jd-product-model.ts'
|
||||
|
||||
test('类目级联静态导航树——服饰内衣二级与京麦面板样本逐字同源,一级集非空且无重名', () => {
|
||||
// 京麦面板真机样本(2026-11-16 客户截图):服饰内衣下就是这五个二级,改名即红。
|
||||
assert.deepEqual(jdCategoryNavChildren('服饰内衣'), ['服饰配件', '内衣', '女装', '男装', '定制服装/工装'])
|
||||
assert.deepEqual(jdCategoryNavChildren('不存在的类目'), [], '未知一级回落空子级(面板不出第二栏)')
|
||||
|
||||
const roots = jdCategoryNavRoots()
|
||||
assert.ok(roots.length >= 20, `一级导航 ${roots.length} 个,常用集不应被清空`)
|
||||
assert.equal(new Set(roots).size, roots.length, '一级类目名不得重复')
|
||||
assert.equal(roots[0], '服饰内衣', '服饰内衣置首(客户商品全在服饰类目)')
|
||||
for (const root of roots) {
|
||||
const children = jdCategoryNavChildren(root)
|
||||
assert.equal(new Set(children).size, children.length, `${root} 的二级不得重复`)
|
||||
}
|
||||
})
|
||||
|
||||
test('京东列表参数——snake 形状:groupId 空→不带、有值→group_id,日期空白/非法不下发', () => {
|
||||
const full = toJdProductListParams(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user