mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
16 lines
574 B
TypeScript
16 lines
574 B
TypeScript
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('设置');
|
|
});
|
|
});
|