| 123456789101112131415161718192021222324252627282930 |
- import BaseMenu from "~/use/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"
- });
- })
- })
|