6 changed files with 11 additions and 27 deletions
@ -1,24 +0,0 @@ |
|||
import { getMenuMatches } from './BaseMenu'; |
|||
|
|||
const menu = ['/dashboard', '/userinfo', '/dashboard/name', '/userinfo/:id', '/userinfo/:id/info']; |
|||
|
|||
describe('test menu match', () => { |
|||
it('simple path', () => { |
|||
expect(getMenuMatches(menu, '/dashboard')).toEqual(['/dashboard']); |
|||
}); |
|||
it('error path', () => { |
|||
expect(getMenuMatches(menu, '/dashboardname')).toEqual([]); |
|||
}); |
|||
|
|||
it('Secondary path', () => { |
|||
expect(getMenuMatches(menu, '/dashboard/name')).toEqual(['/dashboard/name']); |
|||
}); |
|||
|
|||
it('Parameter path', () => { |
|||
expect(getMenuMatches(menu, '/userinfo/2144')).toEqual(['/userinfo/:id']); |
|||
}); |
|||
|
|||
it('three parameter path', () => { |
|||
expect(getMenuMatches(menu, '/userinfo/2144/info')).toEqual(['/userinfo/:id/info']); |
|||
}); |
|||
}); |
|||
@ -1,5 +1,5 @@ |
|||
import { urlToList } from '../_utils/pathTools'; |
|||
import { getFlatMenuKeys, getMenuMatchKeys } from './SiderMenu'; |
|||
import { getFlatMenuKeys, getMenuMatchKeys } from './SliderMenu'; |
|||
|
|||
const menu = [ |
|||
{ |
|||
Loading…
Reference in new issue