Browse Source

fix unit tests and minor fixes

Olivier Massot 1 year ago
parent
commit
0c2ebb4c28
23 changed files with 117 additions and 7 deletions
  1. 2 0
      nuxt.config.ts
  2. 2 1
      services/layout/menuBuilder/abstractMenuBuilder.ts
  3. 1 2
      services/layout/menuBuilder/basicomptaMenuBuilder.ts
  4. 4 1
      tests/units/services/layout/menuBuilder/abstractMenuBuilder.test.ts
  5. 7 0
      tests/units/services/layout/menuBuilder/accessMenuBuilder.test.ts
  6. 15 0
      tests/units/services/layout/menuBuilder/accountMenuBuilder.test.ts
  7. 7 0
      tests/units/services/layout/menuBuilder/admin2iosMenuBuilder.test.ts
  8. 2 0
      tests/units/services/layout/menuBuilder/agendaMenuBuilder.test.ts
  9. 9 0
      tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts
  10. 3 0
      tests/units/services/layout/menuBuilder/communicationMenuBuilder.test.ts
  11. 9 0
      tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts
  12. 17 0
      tests/units/services/layout/menuBuilder/cotisationsMenuBuilder.test.ts
  13. 1 0
      tests/units/services/layout/menuBuilder/donorsMenuBuilder.test.ts
  14. 6 0
      tests/units/services/layout/menuBuilder/educationalMenuBuilder.test.ts
  15. 1 0
      tests/units/services/layout/menuBuilder/equipmentMenuBuilder.test.ts
  16. 1 1
      tests/units/services/layout/menuBuilder/mainMenuBuilder.test.ts
  17. 3 0
      tests/units/services/layout/menuBuilder/myAccessesMenuBuilder.test.ts
  18. 4 0
      tests/units/services/layout/menuBuilder/myFamilyMenuBuilder.test.ts
  19. 4 0
      tests/units/services/layout/menuBuilder/statsMenuBuilder.test.ts
  20. 1 0
      tests/units/services/layout/menuBuilder/websiteAdminMenuBuilder.test.ts
  21. 7 0
      tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts
  22. 8 0
      types/enum/enums.ts
  23. 3 2
      types/layout.d.ts

+ 2 - 0
nuxt.config.ts

@@ -46,6 +46,7 @@ export default defineNuxtConfig({
     baseUrlMercure: '',
     fileStorageBaseUrl: '',
     supportUrl: '',
+    basicomptaUrl: 'https://app.basicompta.fr/',
     // Config within public will be also exposed to the client
     public: {
       env: '',
@@ -56,6 +57,7 @@ export default defineNuxtConfig({
       baseUrlMercure: '',
       fileStorageBaseUrl: '',
       supportUrl: '',
+      basicomptaUrl: 'https://app.basicompta.fr/',
     },
   },
   hooks: {

+ 2 - 1
services/layout/menuBuilder/abstractMenuBuilder.ts

@@ -11,6 +11,7 @@ import type {
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 import UrlUtils from '~/services/utils/urlUtils'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
+import { LINK_TARGET } from '~/types/enum/enums'
 
 /**
  * Classe de base des menus et sous-menus.
@@ -120,7 +121,7 @@ abstract class AbstractMenuBuilder implements MenuBuilder {
       to: url,
       type,
       active: false,
-      target: newTab ? '_blank' : '_self',
+      target: newTab ? LINK_TARGET.BLANK : LINK_TARGET.SELF,
     }
   }
 

+ 1 - 2
services/layout/menuBuilder/basicomptaMenuBuilder.ts

@@ -15,11 +15,10 @@ export default class BasicomptaMenuBuilder extends AbstractMenuBuilder {
       this.accessProfile.isAdministratifManager ||
       this.accessProfile.isFinancialManager
     ) {
-      const url = 'https://app.basicompta.fr/'
       return this.createItem(
         'basicompta_admin',
         { name: 'fas fa-suitcase' },
-        url,
+        this.runtimeConfig.public.basicomptaUrl,
         MENU_LINK_TYPE.EXTERNAL,
         true,
       )

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

@@ -6,6 +6,7 @@ import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuild
 import type { IconItem, MenuGroup, MenuItem, MenuItems } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
+import {LINK_TARGET} from '~/types/enum/enums';
 
 class TestableAbstractMenuBuilder extends AbstractMenuBuilder {
   static readonly menuName = 'TestableMenu'
@@ -104,11 +105,12 @@ describe('createItem', () => {
     const label = 'my_menu'
     const icon = { name: 'my_icon' }
     const to = 'https://domain.com/foo/bar'
+    const target = LINK_TARGET.SELF
     const type = MENU_LINK_TYPE.EXTERNAL
 
     const result = menuBuilder.createItem(label, icon, to, type)
 
-    expect(result).toEqual({ icon, label, to, type, active: false })
+    expect(result).toEqual({ icon, label, to, target, type, active: false })
   })
 
   test('default values', () => {
@@ -118,6 +120,7 @@ describe('createItem', () => {
       label: 'my_menu',
       icon: undefined,
       to: '',
+      target: '_self',
       type: MENU_LINK_TYPE.INTERNAL,
       active: false,
     })

+ 7 - 0
tests/units/services/layout/menuBuilder/accessMenuBuilder.test.ts

@@ -71,6 +71,7 @@ describe('build', () => {
       label: 'person',
       icon: { name: 'fas fa-user' },
       to: 'https://mydomain.com/#/students/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'person',
       icon: { name: 'fas fa-user' },
       to: 'https://mydomain.com/#/adherent/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'family_view',
       icon: { name: 'fas fa-users' },
       to: 'https://mydomain.com/#/student_registration/new',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -112,6 +115,7 @@ describe('build', () => {
       label: 'education_student_next_year',
       icon: { name: 'fas fa-list-alt' },
       to: 'https://mydomain.com/#/education_student_next_year/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -127,6 +131,7 @@ describe('build', () => {
       label: 'commissions',
       icon: { name: 'fas fa-street-view' },
       to: 'https://mydomain.com/#/commissions/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -142,6 +147,7 @@ describe('build', () => {
       label: 'network',
       icon: { name: 'fas fa-sitemap' },
       to: 'https://mydomain.com/#/networks/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -157,6 +163,7 @@ describe('build', () => {
       label: 'my_network',
       icon: { name: 'fas fa-sitemap' },
       to: 'https://mydomain.com/#/network_artist_schools/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 15 - 0
tests/units/services/layout/menuBuilder/accountMenuBuilder.test.ts

@@ -66,6 +66,7 @@ describe('build', () => {
         label: 'logout',
         icon: undefined,
         to: 'https://mydomain.com/#/logout',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -112,6 +113,7 @@ describe('build', () => {
         label: 'logout',
         icon: undefined,
         to: 'https://mydomain.com/#/logout',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -129,6 +131,7 @@ describe('build', () => {
       label: 'my_schedule_page',
       icon: undefined,
       to: 'https://mydomain.com/#/my_calendar',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -145,6 +148,7 @@ describe('build', () => {
       label: 'attendance_bookings_menu',
       icon: undefined,
       to: 'https://mydomain.com/#/own_attendance',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -161,6 +165,7 @@ describe('build', () => {
       label: 'my_attendance',
       icon: undefined,
       to: 'https://mydomain.com/#/my_attendances/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -177,6 +182,7 @@ describe('build', () => {
       label: 'my_invitation',
       icon: undefined,
       to: 'https://mydomain.com/#/my_invitations/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -193,6 +199,7 @@ describe('build', () => {
       label: 'my_students',
       icon: undefined,
       to: 'https://mydomain.com/#/my_students/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -210,6 +217,7 @@ describe('build', () => {
       label: 'my_students_education_students',
       icon: undefined,
       to: 'https://mydomain.com/#/my_students_education_students/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -226,6 +234,7 @@ describe('build', () => {
       label: 'my_education_students',
       icon: undefined,
       to: 'https://mydomain.com/#/main/my_profile/123/dashboard/my_education_students/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -242,6 +251,7 @@ describe('build', () => {
       label: 'send_an_email',
       icon: undefined,
       to: 'https://mydomain.com/#/list/create/emails',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -258,6 +268,7 @@ describe('build', () => {
       label: 'my_documents',
       icon: undefined,
       to: 'https://mydomain.com/#/main/my_profile/123/dashboard/show/my_access_file',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -274,6 +285,7 @@ describe('build', () => {
       label: 'my_profile',
       icon: undefined,
       to: 'https://mydomain.com/#/main/my_profile/123/dashboard',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -290,6 +302,7 @@ describe('build', () => {
       label: 'adherent_list',
       icon: undefined,
       to: 'https://mydomain.com/#/adherent_contacts/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -328,6 +341,7 @@ describe('build', () => {
       label: 'my_bills',
       icon: undefined,
       to: 'https://mydomain.com/#/main/my_profile/123/dashboard/show/my_bills',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -344,6 +358,7 @@ describe('build', () => {
       label: 'print_my_licence',
       icon: undefined,
       to: 'https://mydomain.com/#/licence_cmf/user',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 7 - 0
tests/units/services/layout/menuBuilder/admin2iosMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'all_accesses',
       icon: { name: 'fas fa-users' },
       to: 'https://mydomain.com/#/all_accesses/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'all_organizations',
       icon: { name: 'fas fa-building' },
       to: 'https://mydomain.com/#/organization_params/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'tips',
       icon: { name: 'fas fa-info-circle' },
       to: 'https://mydomain.com/#/tips/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -112,6 +115,7 @@ describe('build', () => {
       label: 'dgv',
       icon: { name: 'fas fa-house-damage' },
       to: 'https://mydomain.com/#/admin2ios/dgv',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -127,6 +131,7 @@ describe('build', () => {
       label: 'cmf_cotisation',
       icon: { name: 'fas fa-info-circle' },
       to: 'https://mydomain.com/#/admin2ios/cotisationcmf',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -142,6 +147,7 @@ describe('build', () => {
       label: 'right_menu',
       icon: { name: 'fas fa-balance-scale-right' },
       to: 'https://mydomain.com/#/admin2ios/right',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -157,6 +163,7 @@ describe('build', () => {
       label: 'tree_menu',
       icon: { name: 'fas fa-sitemap' },
       to: 'https://mydomain.com/#/admin2ios/tree',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 2 - 0
tests/units/services/layout/menuBuilder/agendaMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'schedule',
       icon: { name: 'fas fa-calendar-alt' },
       to: 'https://mydomain.com/#/calendar',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'attendances',
       icon: { name: 'fas fa-calendar-check' },
       to: 'https://mydomain.com/#/attendances/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 9 - 0
tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'billing_product',
       icon: { name: 'fas fa-cube' },
       to: 'https://mydomain.com/#/intangibles/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'billing_products_by_student',
       icon: { name: 'fas fa-cubes' },
       to: 'https://mydomain.com/#/access_intangibles/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'billing_edition',
       icon: { name: 'fas fa-copy' },
       to: 'https://mydomain.com/#/billing_edition',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -112,6 +115,7 @@ describe('build', () => {
       label: 'billing_accounting',
       icon: { name: 'fas fa-file-alt' },
       to: 'https://mydomain.com/#/bill_accountings/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -127,6 +131,7 @@ describe('build', () => {
       label: 'billing_payment_list',
       icon: { name: 'fas fa-credit-card' },
       to: 'https://mydomain.com/#/bill_payments_list/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -142,6 +147,7 @@ describe('build', () => {
       label: 'pes_export',
       icon: { name: 'fas fa-align-justify' },
       to: 'https://mydomain.com/#/pes/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -157,6 +163,7 @@ describe('build', () => {
       label: 'berger_levrault_export',
       icon: { name: 'fas fa-align-justify' },
       to: 'https://mydomain.com/#/berger_levraults/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -172,6 +179,7 @@ describe('build', () => {
       label: 'jvs_export',
       icon: { name: 'fas fa-align-justify' },
       to: 'https://mydomain.com/#/jvs/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -187,6 +195,7 @@ describe('build', () => {
       label: 'afi_export',
       icon: { name: 'fas fa-align-justify' },
       to: 'https://mydomain.com/#/afis/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 3 - 0
tests/units/services/layout/menuBuilder/communicationMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'inbox',
       icon: { name: 'fas fa-inbox' },
       to: 'https://mydomain.com/#/messages/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'message_send',
       icon: { name: 'fas fa-paper-plane' },
       to: 'https://mydomain.com/#/messagessends/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'message_templates',
       icon: { name: 'fas fa-edit' },
       to: 'https://mydomain.com/#/templates/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 9 - 0
tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts

@@ -68,6 +68,7 @@ describe('build', () => {
       label: 'organization_page',
       icon: undefined,
       to: 'https://mydomain.com/#/main/organizations/123/dashboard',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -83,6 +84,7 @@ describe('build', () => {
       label: 'cmf_licence_generate',
       icon: undefined,
       to: 'https://mydomain.com/#/licence_cmf/organization',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -108,6 +110,7 @@ describe('build', () => {
       label: 'parameters',
       icon: undefined,
       to: 'https://mydomain.com/#/main/edit/parameters/123',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -131,6 +134,7 @@ describe('build', () => {
       label: 'places',
       icon: undefined,
       to: 'https://mydomain.com/#/places/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -146,6 +150,7 @@ describe('build', () => {
       label: 'education',
       icon: undefined,
       to: 'https://mydomain.com/#/educations/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -161,6 +166,7 @@ describe('build', () => {
       label: 'tags',
       icon: undefined,
       to: 'https://mydomain.com/#/taggs/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -176,6 +182,7 @@ describe('build', () => {
       label: 'activities',
       icon: undefined,
       to: 'https://mydomain.com/#/activities/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -191,6 +198,7 @@ describe('build', () => {
       label: 'course_duplication',
       icon: undefined,
       to: 'https://mydomain.com/#/duplicate_courses',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -206,6 +214,7 @@ describe('build', () => {
       label: 'import',
       icon: undefined,
       to: 'https://mydomain.com/#/import/all',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 17 - 0
tests/units/services/layout/menuBuilder/cotisationsMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'rate_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/rate',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'parameters_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/parameter',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'send_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/send',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -112,6 +115,7 @@ describe('build', () => {
       label: 'state_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/state',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -127,6 +131,7 @@ describe('build', () => {
       label: 'pay_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/pay',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -142,6 +147,7 @@ describe('build', () => {
       label: 'check_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/check',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -157,6 +163,7 @@ describe('build', () => {
       label: 'ledger_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/ledger',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -172,6 +179,7 @@ describe('build', () => {
       label: 'magazine_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/magazine',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -187,6 +195,7 @@ describe('build', () => {
       label: 'ventilated_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/ventilated',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -202,6 +211,7 @@ describe('build', () => {
       label: 'pay_erase_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/payerase',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -217,6 +227,7 @@ describe('build', () => {
       label: 'resume_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/resume',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -232,6 +243,7 @@ describe('build', () => {
       label: 'history_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/history',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -247,6 +259,7 @@ describe('build', () => {
       label: 'call_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/call',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -262,6 +275,7 @@ describe('build', () => {
       label: 'history_structure_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/historystructure',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -277,6 +291,7 @@ describe('build', () => {
       label: 'insurance_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/insurance',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -292,6 +307,7 @@ describe('build', () => {
       label: 'resume_all_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/resumeall',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -307,6 +323,7 @@ describe('build', () => {
       label: 'resume_pay_cotisation',
       icon: { name: 'fas fa-euro-sign' },
       to: 'https://mydomain.com/#/cotisation/resumepay',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 1 - 0
tests/units/services/layout/menuBuilder/donorsMenuBuilder.test.ts

@@ -50,6 +50,7 @@ describe('build', () => {
       label: 'donors',
       icon: { name: 'fas fa-handshake' },
       to: 'https://mydomain.com/#/donors/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

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

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'criteria_notations',
       icon: { name: 'fas fa-bars' },
       to: 'https://mydomain.com/#/criteria_notations/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -82,6 +83,7 @@ describe('build', () => {
       label: 'seizure_period',
       icon: { name: 'fas fa-calendar-alt' },
       to: 'https://mydomain.com/#/education_teachers/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -97,6 +99,7 @@ describe('build', () => {
       label: 'test_seizure',
       icon: { name: 'fas fa-pencil-alt' },
       to: 'https://mydomain.com/#/education_input/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -112,6 +115,7 @@ describe('build', () => {
       label: 'test_validation',
       icon: { name: 'fas fa-check' },
       to: 'https://mydomain.com/#/education_notations/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -127,6 +131,7 @@ describe('build', () => {
       label: 'examen_results',
       icon: { name: 'fas fa-graduation-cap' },
       to: 'https://mydomain.com/#/examen_convocations/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -143,6 +148,7 @@ describe('build', () => {
       label: 'education_by_student_validation',
       icon: { name: 'fas fa-check-square' },
       to: 'https://mydomain.com/#/education_by_student/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 1 - 0
tests/units/services/layout/menuBuilder/equipmentMenuBuilder.test.ts

@@ -50,6 +50,7 @@ describe('build', () => {
       label: 'equipment',
       icon: { name: 'fas fa-cube' },
       to: 'https://mydomain.com/#/equipment/list/',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

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

@@ -90,7 +90,7 @@ describe('build', () => {
 
     expect(result.label).toEqual('main')
     expect(result.icon).toEqual(undefined)
-    expect((result.children ?? []).length).toEqual(12)
+    expect((result.children ?? []).length).toEqual(13)
   })
 
   test('return a single group', () => {

+ 3 - 0
tests/units/services/layout/menuBuilder/myAccessesMenuBuilder.test.ts

@@ -62,6 +62,7 @@ describe('build', () => {
         label: 'Bob',
         icon: undefined,
         to: 'https://mydomain.com/#/switch/1',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -69,6 +70,7 @@ describe('build', () => {
         label: 'Séraphin',
         icon: undefined,
         to: 'https://mydomain.com/#/switch/2',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -76,6 +78,7 @@ describe('build', () => {
         label: 'Lilou',
         icon: undefined,
         to: 'https://mydomain.com/#/switch/3',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },

+ 4 - 0
tests/units/services/layout/menuBuilder/myFamilyMenuBuilder.test.ts

@@ -93,6 +93,7 @@ describe('build', () => {
         label: 'Dupont Bob',
         icon: { avatarId: 1, avatarByDefault: '/images/default/men-1.png' },
         to: 'https://mydomain.com/#/switch_user/100/1/1',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -100,6 +101,7 @@ describe('build', () => {
         label: 'Dupuis Séraphin',
         icon: { avatarId: 2, avatarByDefault: '/images/default/men-1.png' },
         to: 'https://mydomain.com/#/switch_user/100/1/2',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -107,6 +109,7 @@ describe('build', () => {
         label: 'Dubois Lilou',
         icon: { avatarId: 3, avatarByDefault: '/images/default/women-1.png' },
         to: 'https://mydomain.com/#/switch_user/100/1/3',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -114,6 +117,7 @@ describe('build', () => {
         label: 'Soprano Tony',
         icon: undefined,
         to: 'https://mydomain.com/#/switch_user/100/4/exit',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },

+ 4 - 0
tests/units/services/layout/menuBuilder/statsMenuBuilder.test.ts

@@ -67,6 +67,7 @@ describe('build', () => {
       label: 'report_activity',
       icon: { name: 'fas fa-chart-bar' },
       to: 'https://mydomain.com/#/report_activity',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })
@@ -85,6 +86,7 @@ describe('build', () => {
         label: 'educations_quotas_by_education',
         icon: { name: 'fas fa-user-circle' },
         to: 'https://mydomain.com/#/educations_quotas_by_education_year/list/',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -92,6 +94,7 @@ describe('build', () => {
         label: 'accesses_quotas_courses_hebdos',
         icon: { name: 'fas fa-user-circle' },
         to: 'https://mydomain.com/#/accesses_quotas_courses_hebdos/list/',
+        target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
       },
@@ -108,6 +111,7 @@ describe('build', () => {
       label: 'fede_stats',
       icon: { name: 'fas fa-chart-bar' },
       to: 'https://mydomain.com/#/statistic/membersfedeonly',
+      target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
     })

+ 1 - 0
tests/units/services/layout/menuBuilder/websiteAdminMenuBuilder.test.ts

@@ -55,6 +55,7 @@ describe('build', () => {
       label: 'advanced_modification',
       icon: { name: 'fas fa-globe-americas' },
       to: 'https://some-website.com/typo3',
+      target: '_self',
       type: MENU_LINK_TYPE.EXTERNAL,
       active: false,
     })

+ 7 - 0
tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts

@@ -58,6 +58,7 @@ describe('build', () => {
         label: 'MyOrganization',
         icon: undefined,
         to: 'https://some-website.com',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -80,6 +81,7 @@ describe('build', () => {
         label: 'parent1',
         icon: undefined,
         to: 'https://parent1.net',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -87,6 +89,7 @@ describe('build', () => {
         label: 'parent2',
         icon: undefined,
         to: 'https://parent2.net',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -94,6 +97,7 @@ describe('build', () => {
         label: 'parent3',
         icon: undefined,
         to: 'https://parent3.net',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -118,6 +122,7 @@ describe('build', () => {
         label: 'MyOrganization',
         icon: undefined,
         to: 'https://some-website.com',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -125,6 +130,7 @@ describe('build', () => {
         label: 'parent1',
         icon: undefined,
         to: 'https://parent1.net',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },
@@ -132,6 +138,7 @@ describe('build', () => {
         label: 'parent2',
         icon: undefined,
         to: 'https://parent2.net',
+        target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
       },

+ 8 - 0
types/enum/enums.ts

@@ -97,3 +97,11 @@ export const enum FILE_TYPE {
   BILL = 'BILL',
   UPLOADED = 'UPLOADED',
 }
+
+export const enum LINK_TARGET {
+  BLANK = '_blank',
+  SELF = '_self',
+  PARENT = '_parent',
+  TOP = '_top',
+  FRAMENAME = 'framename',
+}

+ 3 - 2
types/layout.d.ts

@@ -1,4 +1,5 @@
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
+import { LINK_TARGET } from '~/types/enum/enums'
 
 interface IconItem {
   name?: string
@@ -19,7 +20,7 @@ interface MenuItem {
   /** Correspond à la page actuelle */
   active: boolean
   /** Définit l'attribut 'target' du lien */
-  target?: '_blank' | '_self' | '_parent' | '_top' | 'framename'
+  target?: LINK_TARGET
 }
 
 /**
@@ -30,7 +31,7 @@ interface MenuGroup {
   icon?: IconItem
   children?: MenuItems
   actions?: MenuItems
-  target?: '_blank' | '_self' | '_parent' | '_top' | 'framename'
+  target?: LINK_TARGET
 }
 
 type MenuItems = Array<MenuItem | MenuGroup>