forked from lunanting/cangku
28 lines
1.6 KiB
JavaScript
28 lines
1.6 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { parseSidebarConfig } from '../src/config/sidebarNavigation.js';
|
|
|
|
test('legacy saved menus cannot resurrect retired features and keep business customizations', () => {
|
|
const result = parseSidebarConfig(JSON.stringify({ entries: [
|
|
{ key: 'market-insight', routeKey: 'market-insight', visible: true },
|
|
{ key: 'agent', routeKey: 'agent' },
|
|
{ key: 'store-management', children: [{ key: 'store-checkup', routeKey: 'store-checkup' }] },
|
|
{ key: 'operation-tools', children: [{ key: 'pricing-calculator', routeKey: 'pricing-calculator' }] },
|
|
{ key: 'manage', children: [
|
|
{ key: 'ai-skill-tags', routeKey: 'ai-skill-tags' },
|
|
{ key: 'desktop-client-releases', routeKey: 'desktop-client-releases' },
|
|
] },
|
|
{ key: 'product-monitoring', routeKey: 'product-monitoring', label: '我的商品监控', order: 1 },
|
|
{ key: 'ops-b-incentive', routeKey: 'ops-b-incentive' },
|
|
{ key: 'marketing-management', children: [{ key: 'marketing-events', routeKey: 'marketing-events' }] },
|
|
{ key: 'product-management', children: [{ key: 'product-analysis', routeKey: 'product-analysis' }] },
|
|
] }));
|
|
const entries = result.entries.flatMap((entry) => [entry, ...(entry.children || [])]);
|
|
assert.ok(entries.every((entry) => ![
|
|
'market-insight', 'agent', 'ai-skill-tags', 'store-management', 'operation-tools',
|
|
'desktop-client-releases', 'product-monitoring', 'ops-b-incentive',
|
|
'marketing-management', 'marketing-events', 'product-management', 'product-analysis',
|
|
].includes(entry.key)));
|
|
assert.ok(entries.some((entry) => entry.key === 'settings'));
|
|
});
|