committed by
陈帅
5 changed files with 32 additions and 32 deletions
@ -0,0 +1,24 @@ |
|||
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,24 +0,0 @@ |
|||
import { getMeunMatcheys } from './BaseMeun'; |
|||
|
|||
const meun = ['/dashboard', '/userinfo', '/dashboard/name', '/userinfo/:id', '/userinfo/:id/info']; |
|||
|
|||
describe('test meun match', () => { |
|||
it('simple path', () => { |
|||
expect(getMeunMatcheys(meun, '/dashboard')).toEqual(['/dashboard']); |
|||
}); |
|||
it('error path', () => { |
|||
expect(getMeunMatcheys(meun, '/dashboardname')).toEqual([]); |
|||
}); |
|||
|
|||
it('Secondary path', () => { |
|||
expect(getMeunMatcheys(meun, '/dashboard/name')).toEqual(['/dashboard/name']); |
|||
}); |
|||
|
|||
it('Parameter path', () => { |
|||
expect(getMeunMatcheys(meun, '/userinfo/2144')).toEqual(['/userinfo/:id']); |
|||
}); |
|||
|
|||
it('three parameter path', () => { |
|||
expect(getMeunMatcheys(meun, '/userinfo/2144/info')).toEqual(['/userinfo/:id/info']); |
|||
}); |
|||
}); |
|||
Loading…
Reference in new issue