Files
crawler-plugin/admin-frontend-vue/tests/group-dropdown-platform-scope.test.ts
T
huangzd1997 79b6f76654 fix(jd-database): 亚马逊侧分组下拉按平台归属过滤——京东档组不再漏进亚马逊侧(2026-11-22 用户口径「京东创建的分组就归属京东 下拉就只能显示京东分组管理的 亚马逊的也是同理」)
- shop-manage-api.ts::fetchShopManageGroups / dedupe-total-api.ts::fetchDedupeTotalGroups 恒带 platform=amazon(company_id 条件透传不变,后端 listGroups 本就支持该参数,零后端改动)——查询ASIN/跟价/去重/外观专利清理 4 个亚马逊域页面的分组下拉此前会把京东-团队/测试1111 等 jd 档组漏进来
- 京东侧无需改动:三条建组路径(分组管理页按平台 tab、京东分类弹窗直建恒 jd、后端缺省 amazon)打档正确,JdCategoryScopeService.retainJdPlatformGroups 平台闸已在线上(本轮云助手只读探针实证:测试1111=公司4阿华66 11-18 京东档建的合法工作组;admin 平台超管看所有、公司超管看公司下所有=现行口径,用户拍板维持)
- 测试:新增 tests/group-dropdown-platform-scope.test.ts(恒 amazon+company_id 透传不丢+分组管理页仍跟平台 tab 反向钉);company-tab-wiring.test.ts 精确行钉同步;source-pin-ledger.json 重生成(+1 文件/+2 例/+2 钉,delta 仅本窗)
- 验证:vue-tsc rc=0;后管全量 node --test 1959/1959 绿;fast 闸后管面 9 格全绿(分 8.8,账本 2026-11-22T16:1x);客户端/用户端红格为另窗在飞件非本笔
2026-11-22 16:19:43 +08:00

42 lines
2.8 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 { readSource } from './helpers.ts'
/**
* 分组下拉按平台归属过滤(2026-11-22 用户口径「京东创建的分组就归属京东,
* 下拉就只能显示京东分组管理的,亚马逊的也是同理」)。
*
* 背景:biz_shop_manage_group 一张表服务两侧(platform 列 V206 起 amazon|jd),
* 京东侧(JdCategoryScopeService + /api/jd-collect/groups)已有 platform='jd' 闸;
* 亚马逊侧四个页面(查询ASIN/跟价/去重/外观专利清理)共用的两个取数口原本不传
* platform ⇒ 京东档分组(如「京东-团队」「测试1111」)漏进亚马逊侧下拉。
* 两支源码钉守住发送口形状:platform 恒 'amazon' 且 company_id 条件透传不丢。
*/
test('amazon_group_dropdowns_send_platform_amazon_and_keep_company_id_passthrough', () => {
const dedupe = readSource('src/pages/asin/dedupe-total-api.ts')
assert.match(dedupe, /DEDUPE_GROUPS_ENDPOINT, \{ params: \{ platform: 'amazon', \.\.\.\(companyId != null \? \{ company_id: companyId \} : \{\}\) \} \}/,
'去重/外观专利清理页的分组候选必须恒带 platform=amazon(京东档组不进亚马逊侧下拉)')
assert.match(dedupe, /export async function fetchDedupeTotalGroups\(companyId\?: number \| null\)/,
'签名不变:company_id 仍由调用方(公司 tab)传入')
const shopManage = readSource('src/pages/shop/shop-manage-api.ts')
assert.match(shopManage, /SHOP_MANAGE_GROUPS_ENDPOINT, \{ params: \{ platform: 'amazon', \.\.\.\(companyId != null \? \{ company_id: companyId \} : \{\}\) \} \}/,
'店铺/查询ASIN/跟价页的分组下拉必须恒带 platform=amazon')
assert.match(shopManage, /export async function fetchShopManageGroups\(companyId\?: number \| null\)/,
'签名不变:company_id 仍由调用方(公司 tab)传入')
})
test('group_manage_page_keeps_following_platform_tab_not_hardcoded', () => {
// 分组管理页本身是双侧页面,继续跟当前平台 tab 走——不许被这批「亚马逊域恒 amazon」
// 顺手改死,否则京东 tab 的分组列表会被清空(2026-11-17 平台闸既有口径)。
const groupsPage = readSource('src/pages/account/GroupsPage.vue')
assert.match(groupsPage, /fetchShopGroups\(companyTab\.requestCompanyId, platformTab\.active\)/,
'分组管理页取数仍按当前平台 tab 过滤')
// 反向钉:两个亚马逊域取数口里不许出现 platformTab(它们不该感知平台 tab)。
const dedupe = readSource('src/pages/asin/dedupe-total-api.ts')
const shopManage = readSource('src/pages/shop/shop-manage-api.ts')
assert.equal(/platformTab/.test(dedupe), false, '去重取数口不感知平台 tab(恒 amazon)')
assert.equal(/platformTab/.test(shopManage), false, '店铺取数口不感知平台 tab(恒 amazon)')
})