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', 'icon', '/url', false)
    expect(menuWithoutChildren).toStrictEqual({
      title: 'children',
      icon: 'icon',
      to: '/url',
      isExternalLink: false
    })
  })

  it('should construct a menu with children', () => {
    const menuWithoutChildren = new BaseMenu({ baseURL_adminLegacy: 'base_url' }).constructMenu('children', 'icon', '/url', false)
    const menuWithChildren = new BaseMenu({ baseURL_adminLegacy: 'base_url' }).constructMenu('parent', 'icon', undefined, undefined, [menuWithoutChildren])
    expect(menuWithChildren).toStrictEqual({
      children: [
        {
          title: 'children',
          icon: 'icon',
          to: '/url',
          isExternalLink: false
        }
      ],
      icon: 'icon',
      title: 'parent'
    })
  })
})
