cangku/frontend/test/retiredNavigation.test.mjs

23 lines
1.4 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 },
] }));
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'].includes(entry.key)));
assert.equal(entries.find((entry) => entry.key === 'product-monitoring').label, '我的商品监控');
assert.ok(entries.some((entry) => entry.key === 'settings'));
assert.ok(entries.some((entry) => entry.key === 'product-analysis'));
});