|
|
|
@ -28,22 +28,22 @@ describe('test convert tree structure menu paths to flat menu paths', () => { |
|
|
|
|
|
|
|
describe('test menu match', () => { |
|
|
|
it('simple path', () => { |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboard'), true)).toEqual(['/dashboard']); |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboard'))).toEqual(['/dashboard']); |
|
|
|
}); |
|
|
|
|
|
|
|
it('error path', () => { |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboardname'), true)).toEqual([]); |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboardname'))).toEqual([]); |
|
|
|
}); |
|
|
|
|
|
|
|
it('Secondary path', () => { |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboard/name'), true)).toEqual(['/dashboard', '/dashboard/name']); |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/dashboard/name'))).toEqual(['/dashboard', '/dashboard/name']); |
|
|
|
}); |
|
|
|
|
|
|
|
it('Parameter path', () => { |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/userinfo/2144'), true)).toEqual(['/userinfo', '/userinfo/:id']); |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/userinfo/2144'))).toEqual(['/userinfo', '/userinfo/:id']); |
|
|
|
}); |
|
|
|
|
|
|
|
it('three parameter path', () => { |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/userinfo/2144/info'), false)).toEqual(['/userinfo', '/userinfo/:id', '/userinfo/:id/info']); |
|
|
|
expect(getMeunMatchKeys(flatMenuKeys, urlToList('/userinfo/2144/info'))).toEqual(['/userinfo', '/userinfo/:id', '/userinfo/:id/info']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|