[重构] 资源路径使用单数

This commit is contained in:
ryan
2026-03-11 17:27:37 +08:00
parent 57ac8b6f7c
commit 1bca93b332
13 changed files with 78 additions and 79 deletions
@@ -3,13 +3,13 @@ import { describe, expect, it } from 'vitest';
import { getCurrentNavigationItem, isPathActive } from '@/lib/utils/navigation';
describe('navigation utils', () => {
it('marks root path as active only for home', () => {
expect(isPathActive('/', '/')).toBe(true);
expect(isPathActive('/nodes', '/')).toBe(false);
});
it('resolves current navigation item for nested paths', () => {
expect(getCurrentNavigationItem('/nodes/abc')?.label).toBe('节点管理');
expect(getCurrentNavigationItem('/settings')?.label).toBe('设置');
});
it('marks root path as active only for home', () => {
expect(isPathActive('/', '/')).toBe(true);
expect(isPathActive('/node', '/')).toBe(false);
});
it('resolves current navigation item for nested paths', () => {
expect(getCurrentNavigationItem('/node/abc')?.label).toBe('节点管理');
expect(getCurrentNavigationItem('/setting')?.label).toBe('设置');
});
});