瀏覽代碼

fix menuBuilders tests

Olivier Massot 1 年之前
父節點
當前提交
61920044cf

+ 10 - 1
tests/units/services/layout/menuBuilder/abstractMenuBuilder.test.ts

@@ -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', () => {})
+})

+ 6 - 1
tests/units/services/layout/menuBuilder/accessMenuBuilder.test.ts

@@ -1,6 +1,7 @@
-import { describe, test, it, expect, beforeEach, vi } from 'vitest'
+import { describe, test, expect, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { AnyAbility } from '@casl/ability/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import AccessMenuBuilder from '~/services/layout/menuBuilder/accessMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: AccessMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/admin2iosMenuBuilder.test.ts

@@ -1,6 +1,7 @@
-import { describe, test, it, expect, beforeEach, vi } from 'vitest'
+import { describe, test, expect, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { AnyAbility } from '@casl/ability/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import Admin2iosMenuBuilder from '~/services/layout/menuBuilder/admin2iosMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: Admin2iosMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/agendaMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import AgendaMenuBuilder from '~/services/layout/menuBuilder/agendaMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: AgendaMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import BillingMenuBuilder from '~/services/layout/menuBuilder/billingMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: BillingMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/communicationMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import CommunicationMenuBuilder from '~/services/layout/menuBuilder/communicationMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: CommunicationMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts

@@ -1,6 +1,7 @@
-import { describe, test, it, expect } from 'vitest'
+import { describe, test, vi, expect, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { AnyAbility } from '@casl/ability/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import ConfigurationMenuBuilder from '~/services/layout/menuBuilder/configurationMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: ConfigurationMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/cotisationsMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import CotisationsMenuBuilder from '~/services/layout/menuBuilder/cotisationsMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: CotisationsMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 7 - 2
tests/units/services/layout/menuBuilder/donorsMenuBuilder.test.ts

@@ -1,9 +1,10 @@
-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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import DonorsMenuBuilder from '~/services/layout/menuBuilder/donorsMenuBuilder'
-import type { MenuGroup, MenuItem } from '~/types/layout'
+import type { MenuItem } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 let runtimeConfig: RuntimeConfig
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: DonorsMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/educationalMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import EducationalMenuBuilder from '~/services/layout/menuBuilder/educationalMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: EducationalMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 7 - 2
tests/units/services/layout/menuBuilder/equipmentMenuBuilder.test.ts

@@ -1,9 +1,10 @@
-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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import EquipmentMenuBuilder from '~/services/layout/menuBuilder/equipmentMenuBuilder'
-import type { MenuGroup, MenuItem } from '~/types/layout'
+import type { MenuItem } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 let runtimeConfig: RuntimeConfig
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: EquipmentMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/mainMenuBuilder.test.ts

@@ -1,6 +1,7 @@
-import { describe, test, expect } from 'vitest'
+import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { AnyAbility } from '@casl/ability/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import MainMenuBuilder from '~/services/layout/menuBuilder/mainMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -24,12 +25,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: MainMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -38,6 +42,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 7 - 2
tests/units/services/layout/menuBuilder/medalsMenuBuilder.test.ts

@@ -1,9 +1,10 @@
-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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import MedalsMenuBuilder from '~/services/layout/menuBuilder/medalsMenuBuilder'
-import type { MenuGroup, MenuItem } from '~/types/layout'
+import type { MenuItem } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 let runtimeConfig: RuntimeConfig
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: MedalsMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 7 - 2
tests/units/services/layout/menuBuilder/myAccessesMenuBuilder.test.ts

@@ -1,9 +1,10 @@
-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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import MyAccessesMenuBuilder from '~/services/layout/menuBuilder/myAccessesMenuBuilder'
-import type { MenuGroup, MenuItem } from '~/types/layout'
+import type { MenuGroup } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 let runtimeConfig: RuntimeConfig
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: MyAccessesMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/myFamilyMenuBuilder.test.ts

@@ -1,6 +1,7 @@
-import { describe, expect, test } from 'vitest'
+import { describe, expect, test, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { AnyAbility } from '@casl/ability/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import MyFamilyMenuBuilder from '~/services/layout/menuBuilder/myFamilyMenuBuilder'
 import { GENDER } from '~/types/enum/enums'
@@ -12,12 +13,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: MyFamilyMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -26,6 +30,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/statsMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import StatsMenuBuilder from '~/services/layout/menuBuilder/statsMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: StatsMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 2
tests/units/services/layout/menuBuilder/websiteAdminMenuBuilder.test.ts

@@ -1,9 +1,9 @@
-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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import WebsiteAdminMenuBuilder from '~/services/layout/menuBuilder/websiteAdminMenuBuilder'
-import type { MenuGroup } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 let runtimeConfig: RuntimeConfig
@@ -11,12 +11,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: WebsiteAdminMenuBuilder
+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
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +28,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })
 

+ 6 - 1
tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts

@@ -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/dist/types'
+import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import WebsiteListMenuBuilder from '~/services/layout/menuBuilder/websiteListMenuBuilder'
 import type { MenuGroup } from '~/types/layout'
@@ -11,12 +12,15 @@ let ability: AnyAbility
 let organizationProfile: organizationState
 let accessProfile: AccessProfile
 let menuBuilder: WebsiteListMenuBuilder
+let router: Router
 
 beforeEach(() => {
   runtimeConfig = vi.fn() as any as RuntimeConfig
   ability = vi.fn() as any as AnyAbility
   organizationProfile = {} as any as organizationState
   accessProfile = vi.fn() as any as AccessProfile
+  // @ts-ignore
+  router = vi.fn() as Router
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
 
@@ -25,6 +29,7 @@ beforeEach(() => {
     ability,
     organizationProfile,
     accessProfile,
+    router,
   )
 })