|
|
@@ -3,7 +3,7 @@ import { describe, test, it, expect } from 'vitest'
|
|
|
import {RuntimeConfig} from "@nuxt/schema";
|
|
|
import {AnyAbility} from "@casl/ability/dist/types";
|
|
|
import {AccessProfile, organizationState} from "~/types/interfaces";
|
|
|
-import MedalsMenuBuilder from "~/services/layout/menuBuilder/medalsMenuBuilder";
|
|
|
+import RewardsMenuBuilder from "~/services/layout/menuBuilder/rewardsMenuBuilder";
|
|
|
import {MenuGroup, MenuItem} from "~/types/layout";
|
|
|
import {MENU_LINK_TYPE} from "~/types/enum/layout";
|
|
|
|
|
|
@@ -11,7 +11,7 @@ let runtimeConfig: RuntimeConfig
|
|
|
let ability: AnyAbility
|
|
|
let organizationProfile: organizationState
|
|
|
let accessProfile: AccessProfile
|
|
|
-let menuBuilder: MedalsMenuBuilder
|
|
|
+let menuBuilder: RewardsMenuBuilder
|
|
|
|
|
|
beforeEach(()=> {
|
|
|
runtimeConfig = vi.fn() as any as RuntimeConfig
|
|
|
@@ -21,13 +21,13 @@ beforeEach(()=> {
|
|
|
|
|
|
runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
|
|
|
|
|
|
- menuBuilder = new MedalsMenuBuilder(runtimeConfig, ability, organizationProfile, accessProfile)
|
|
|
+ menuBuilder = new RewardsMenuBuilder(runtimeConfig, ability, organizationProfile, accessProfile)
|
|
|
})
|
|
|
|
|
|
|
|
|
describe('getMenuName', () => {
|
|
|
test('validate name', () => {
|
|
|
- expect(menuBuilder.getMenuName()).toEqual("Medals")
|
|
|
+ expect(menuBuilder.getMenuName()).toEqual("AccessRewards")
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -35,12 +35,13 @@ describe('build', () => {
|
|
|
test('has all items', () => {
|
|
|
ability.can = vi.fn(() => true)
|
|
|
|
|
|
- // Should return a MenuItem
|
|
|
- const result = menuBuilder.build() as MenuItem
|
|
|
+ // Should return a MenuGroup
|
|
|
+ const result = menuBuilder.build() as MenuGroup
|
|
|
|
|
|
- expect(result).toEqual({
|
|
|
- label: 'medals', icon: {name: 'fas fa-trophy'}, to: 'https://mydomain.com/#/medals/list/', type: MENU_LINK_TYPE.V1, active: false
|
|
|
- })
|
|
|
+ expect(result.label).toEqual('access_rewards')
|
|
|
+ expect(result.icon).toEqual({name: 'fas fa-trophy'})
|
|
|
+ // @ts-ignore
|
|
|
+ expect(result.children.length).toEqual(3)
|
|
|
})
|
|
|
|
|
|
test('has no items', () => {
|