| 123456789101112131415161718192021222324252627282930 |
- import BaseMenu from '~/composables/layout/Menus/baseMenu'
- describe('constructMenu()', () => {
- it('should construct a menu without children', () => {
- const menuWithoutChildren = new BaseMenu({ baseURL_adminLegacy: 'base_url' }).constructMenu('children', {name:'icon'}, '/url', false)
- expect(menuWithoutChildren).toStrictEqual({
- title: 'children',
- icon: {name:'icon'},
- to: '/url',
- isExternalLink: false
- })
- })
- it('should construct a menu with children', () => {
- const menuWithoutChildren = new BaseMenu({ baseURL_adminLegacy: 'base_url' }).constructMenu('children', {name:'icon'}, '/url', false)
- const menuWithChildren = new BaseMenu({ baseURL_adminLegacy: 'base_url' }).constructMenu('parent', {name:'icon'}, undefined, undefined, [menuWithoutChildren])
- expect(menuWithChildren).toStrictEqual({
- children: [
- {
- title: 'children',
- icon: {name:'icon'},
- to: '/url',
- isExternalLink: false
- }
- ],
- icon: {name:'icon'},
- title: 'parent'
- })
- })
- })
|