|
|
@@ -1,6 +1,7 @@
|
|
|
-import { describe, test, it, expect } from 'vitest'
|
|
|
+import { describe, test, expect, vi, beforeEach } from 'vitest'
|
|
|
import type { RuntimeConfig } from '@nuxt/schema'
|
|
|
import type { AnyAbility } from '@casl/ability'
|
|
|
+import type { Router } from 'vue-router'
|
|
|
import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
|
|
|
import type { IconItem, MenuGroup, MenuItem, MenuItems } from '~/types/layout'
|
|
|
import { MENU_LINK_TYPE } from '~/types/enum/layout'
|
|
|
@@ -41,18 +42,22 @@ let ability: AnyAbility
|
|
|
let organizationProfile: organizationState
|
|
|
let accessProfile: AccessProfile
|
|
|
let menuBuilder: TestableAbstractMenuBuilder
|
|
|
+let router: Router
|
|
|
|
|
|
beforeEach(() => {
|
|
|
runtimeConfig = vi.fn() as any as RuntimeConfig
|
|
|
ability = vi.fn() as any as AnyAbility
|
|
|
organizationProfile = vi.fn() as any as organizationState
|
|
|
accessProfile = vi.fn() as any as AccessProfile
|
|
|
+ // @ts-ignore
|
|
|
+ router = vi.fn() as Router
|
|
|
|
|
|
menuBuilder = new TestableAbstractMenuBuilder(
|
|
|
runtimeConfig,
|
|
|
ability,
|
|
|
organizationProfile,
|
|
|
accessProfile,
|
|
|
+ router,
|
|
|
)
|
|
|
})
|
|
|
|
|
|
@@ -160,3 +165,7 @@ describe('buildSubmenu', () => {
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+describe('addChildItemIfAllowed', () => {
|
|
|
+ test('simple call', () => {})
|
|
|
+})
|