cangku/frontend/test/retiredNavigation.test.mjs

18 lines
1.0 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: 'manage', children: [{ key: 'ai-skill-tags', routeKey: 'ai-skill-tags' }] },
{ 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'].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'));
});