Browse Source

fix unit tests

Olivier Massot 5 months ago
parent
commit
034e4afb78

+ 19 - 2
tests/units/services/layout/menuBuilder/abstractMenuBuilder.test.ts

@@ -110,7 +110,15 @@ describe('createItem', () => {
 
     const result = menuBuilder.createItem(label, icon, to, type)
 
-    expect(result).toEqual({ icon, label, to, target, type, active: false })
+    expect(result).toEqual({
+      icon,
+      label,
+      to,
+      target,
+      type,
+      active: false,
+      endOfSubsection: false,
+    })
   })
 
   test('default values', () => {
@@ -123,6 +131,7 @@ describe('createItem', () => {
       target: '_self',
       type: MENU_LINK_TYPE.INTERNAL,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -192,6 +201,7 @@ describe('makeChildren', () => {
         to: 'foo',
         type: 0,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })
@@ -207,7 +217,14 @@ describe('makeChildren', () => {
     ])
 
     expect(children).toEqual([
-      { label: 'foo_page', icon: undefined, to: 'foo', type: 0, active: false },
+      {
+        label: 'foo_page',
+        icon: undefined,
+        to: 'foo',
+        type: 0,
+        active: false,
+        endOfSubsection: false,
+      },
     ])
   })
   test('not allowed', () => {

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

@@ -74,6 +74,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
 
     // @ts-ignore
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -118,6 +121,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -134,6 +138,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -150,6 +155,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -166,6 +172,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

+ 117 - 92
tests/units/services/layout/menuBuilder/accountMenuBuilder.test.ts

@@ -61,16 +61,13 @@ describe('build', () => {
 
     // Has the logout action
     // @ts-ignore
-    expect(result.actions).toEqual([
-      {
-        label: 'logout',
-        icon: undefined,
-        to: 'https://mydomain.com/#/logout',
-        target: '_self',
-        type: MENU_LINK_TYPE.V1,
-        active: false,
-      },
-    ])
+    const logoutAction = result.actions[0]
+    expect(logoutAction).toHaveProperty('label', 'logout')
+    expect(logoutAction).toHaveProperty('icon', undefined)
+    expect(logoutAction).toHaveProperty('to', 'https://mydomain.com/#/logout')
+    expect(logoutAction).toHaveProperty('target', '_self')
+    expect(logoutAction).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(logoutAction).toHaveProperty('active', false)
   })
 
   test('has profile icon : mister)', () => {
@@ -108,16 +105,15 @@ describe('build', () => {
 
     // Still has the logout action
     // @ts-ignore
-    expect(group.actions).toEqual([
-      {
-        label: 'logout',
-        icon: undefined,
-        to: 'https://mydomain.com/#/logout',
-        target: '_self',
-        type: MENU_LINK_TYPE.V1,
-        active: false,
-      },
-    ])
+    expect(group.actions.length).toEqual(1)
+    // @ts-ignore
+    const logoutAction = group.actions[0]
+    expect(logoutAction).toHaveProperty('label', 'logout')
+    expect(logoutAction).toHaveProperty('icon', undefined)
+    expect(logoutAction).toHaveProperty('to', 'https://mydomain.com/#/logout')
+    expect(logoutAction).toHaveProperty('target', '_self')
+    expect(logoutAction).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(logoutAction).toHaveProperty('active', false)
   })
 
   test('has only rights for menu my_schedule_page', () => {
@@ -127,14 +123,14 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'my_schedule_page',
-      icon: undefined,
-      to: 'https://mydomain.com/#/my_calendar',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_schedule_page')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty('to', 'https://mydomain.com/#/my_calendar')
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu attendance_bookings_menu', () => {
@@ -144,14 +140,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'attendance_bookings_menu',
-      icon: undefined,
-      to: 'https://mydomain.com/#/own_attendance',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'attendance_bookings_menu')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/own_attendance',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_attendance', () => {
@@ -161,14 +160,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'my_attendance',
-      icon: undefined,
-      to: 'https://mydomain.com/#/my_attendances/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_attendance')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/my_attendances/list/',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_invitation', () => {
@@ -178,14 +180,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'my_invitation',
-      icon: undefined,
-      to: 'https://mydomain.com/#/my_invitations/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_invitation')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/my_invitations/list/',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_students', () => {
@@ -195,14 +200,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'my_students',
-      icon: undefined,
-      to: 'https://mydomain.com/#/my_students/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_students')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/my_students/list/',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_students_education_students', () => {
@@ -213,14 +221,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      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,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_students_education_students')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/my_students_education_students/list/',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_education_students', () => {
@@ -230,14 +241,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      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,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_education_students')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/main/my_profile/123/dashboard/my_education_students/list/',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu send_an_email', () => {
@@ -247,14 +261,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      label: 'send_an_email',
-      icon: undefined,
-      to: 'https://mydomain.com/#/list/create/emails',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'send_an_email')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/list/create/emails',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_documents', () => {
@@ -264,14 +281,17 @@ describe('build', () => {
     )
 
     // @ts-ignore
-    expect(menuBuilder.build().children[0]).toEqual({
-      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,
-    })
+    const menuItem = menuBuilder.build().children[0]
+    expect(menuItem).toHaveProperty('label', 'my_documents')
+    expect(menuItem).toHaveProperty('icon', undefined)
+    expect(menuItem).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/main/my_profile/123/dashboard/show/my_access_file',
+    )
+    expect(menuItem).toHaveProperty('target', '_self')
+    expect(menuItem).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(menuItem).toHaveProperty('active', false)
+    expect(menuItem).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu my_profile', () => {
@@ -288,6 +308,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -305,6 +326,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: true,
     })
   })
 
@@ -325,6 +347,7 @@ describe('build', () => {
       to: 'subscription',
       type: MENU_LINK_TYPE.INTERNAL,
       active: false,
+      endOfSubsection: true,
     })
 
     expect(router.resolve).toHaveBeenCalledWith({ name: 'subscription_page' })
@@ -344,6 +367,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -361,6 +385,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -118,6 +121,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -134,6 +138,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -150,6 +155,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -166,6 +172,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -62,6 +62,7 @@ describe('build', () => {
       type: MENU_LINK_TYPE.V1,
       target: '_self',
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -77,6 +78,7 @@ describe('build', () => {
       type: MENU_LINK_TYPE.V1,
       target: '_self',
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -92,6 +94,7 @@ describe('build', () => {
       type: MENU_LINK_TYPE.V1,
       target: '_self',
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -118,6 +121,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -134,6 +138,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -150,6 +155,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -166,6 +172,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -182,6 +189,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -198,6 +206,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -214,6 +223,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

+ 130 - 104
tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts

@@ -52,7 +52,7 @@ describe('build', () => {
     expect(result.label).toEqual('configuration')
     expect(result.icon).toEqual({ name: 'fas fa-cogs' })
     // @ts-ignore
-    expect(result.children.length).toEqual(16)
+    expect(result.children.length).toEqual(17)
   })
 
   test('has no items', () => {
@@ -67,14 +67,17 @@ describe('build', () => {
     )
     organizationProfile.id = 123
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'organization_page',
-      icon: undefined,
-      to: 'https://mydomain.com/#/main/organizations/123/dashboard',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'organization_page')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/main/organizations/123/dashboard',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu cmf_licence_generate', () => {
@@ -83,14 +86,17 @@ describe('build', () => {
         action === 'display' && subject === 'cmf_licence_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'cmf_licence_generate',
-      icon: undefined,
-      to: 'https://mydomain.com/#/licence_cmf/organization',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'cmf_licence_generate')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/licence_cmf/organization',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
     //
     // expect(menuBuilder.build()).toEqual({
     //   label: 'cmf_licence_generate',
@@ -109,13 +115,12 @@ describe('build', () => {
 
     menuBuilder.organizationProfile.id = 123
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'parameters_page',
-      icon: undefined,
-      to: undefined,
-      type: MENU_LINK_TYPE.INTERNAL,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'parameters_page')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.INTERNAL)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', true)
 
     // expect(menuBuilder.build()).toEqual({
     //   label: 'parameters',
@@ -132,14 +137,14 @@ describe('build', () => {
         action === 'display' && subject === 'place_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'places',
-      icon: undefined,
-      to: 'https://mydomain.com/#/places/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'places')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty('to', 'https://mydomain.com/#/places/list/')
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu education', () => {
@@ -148,14 +153,17 @@ describe('build', () => {
         action === 'display' && subject === 'education_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'education',
-      icon: undefined,
-      to: 'https://mydomain.com/#/educations/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'education')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/educations/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu tag', () => {
@@ -164,14 +172,14 @@ describe('build', () => {
         action === 'display' && subject === 'tag_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'tags',
-      icon: undefined,
-      to: 'https://mydomain.com/#/taggs/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'tags')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty('to', 'https://mydomain.com/#/taggs/list/')
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu activities', () => {
@@ -180,14 +188,17 @@ describe('build', () => {
         action === 'display' && subject === 'activities_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'activities',
-      icon: undefined,
-      to: 'https://mydomain.com/#/activities/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'activities')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/activities/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu course_duplication', () => {
@@ -196,14 +207,17 @@ describe('build', () => {
         action === 'display' && subject === 'course_duplication_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'course_duplication',
-      icon: undefined,
-      to: 'https://mydomain.com/#/duplicate_courses',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'course_duplication')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/duplicate_courses',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', true)
   })
 
   test('has only rights for menu import', () => {
@@ -212,14 +226,14 @@ describe('build', () => {
         action === 'display' && subject === 'import_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'import',
-      icon: undefined,
-      to: 'https://mydomain.com/#/import/all',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'import')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty('to', 'https://mydomain.com/#/import/all')
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu parcours', () => {
@@ -228,14 +242,17 @@ describe('build', () => {
         action === 'display' && subject === 'parcours_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'parcours',
-      icon: undefined,
-      to: 'https://mydomain.com/#/family_quotient_models/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'parcours')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/family_quotient_models/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu family_quotient_models', () => {
@@ -244,14 +261,17 @@ describe('build', () => {
         action === 'display' && subject === 'family_quotient_models_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'family_quotient_models',
-      icon: undefined,
-      to: 'https://mydomain.com/#/family_quotient_models/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'family_quotient_models')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/family_quotient_models/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 
   test('has only rights for menu billing_schedules', () => {
@@ -260,14 +280,17 @@ describe('build', () => {
         action === 'display' && subject === 'billing_schedules_settings_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'billing_schedules',
-      icon: undefined,
-      to: 'https://mydomain.com/#/bill_schedules/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'billing_schedules')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/bill_schedules/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', true)
   })
 
   test('has only rights for menu pseudonymization', () => {
@@ -276,13 +299,16 @@ describe('build', () => {
         action === 'display' && subject === 'pseudonymization_page',
     )
 
-    expect(menuBuilder.build()).toEqual({
-      label: 'pseudonymization',
-      icon: undefined,
-      to: 'https://mydomain.com/#/pseudonymizationList/list/',
-      target: '_self',
-      type: MENU_LINK_TYPE.V1,
-      active: false,
-    })
+    const result = menuBuilder.build()
+    expect(result).toHaveProperty('label', 'pseudonymization')
+    expect(result).toHaveProperty('icon', undefined)
+    expect(result).toHaveProperty(
+      'to',
+      'https://mydomain.com/#/pseudonymizationList/list/',
+    )
+    expect(result).toHaveProperty('target', '_self')
+    expect(result).toHaveProperty('type', MENU_LINK_TYPE.V1)
+    expect(result).toHaveProperty('active', false)
+    expect(result).toHaveProperty('endOfSubsection', false)
   })
 })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -118,6 +121,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -134,6 +138,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -150,6 +155,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -166,6 +172,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -182,6 +189,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -198,6 +206,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -214,6 +223,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -230,6 +240,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -246,6 +257,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -262,6 +274,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -278,6 +291,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -294,6 +308,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -310,6 +325,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -326,6 +342,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -53,6 +53,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -86,6 +87,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -102,6 +104,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -118,6 +121,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -134,6 +138,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -151,6 +156,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -53,6 +53,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 

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

@@ -65,6 +65,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'Séraphin',
@@ -73,6 +74,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'Lilou',
@@ -81,6 +83,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })

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

@@ -96,6 +96,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'Dupuis Séraphin',
@@ -104,6 +105,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'Dubois Lilou',
@@ -112,6 +114,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'Soprano Tony',
@@ -120,6 +123,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })

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

@@ -70,6 +70,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 
@@ -89,6 +90,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'accesses_quotas_courses_hebdos',
@@ -97,6 +99,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.V1,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })
@@ -114,6 +117,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.V1,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -73,6 +73,7 @@ describe('build', () => {
       target: '_self',
       type: MENU_LINK_TYPE.EXTERNAL,
       active: false,
+      endOfSubsection: false,
     })
   })
 })

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

@@ -61,6 +61,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })
@@ -84,6 +85,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'parent2',
@@ -92,6 +94,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'parent3',
@@ -100,6 +103,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })
@@ -125,6 +129,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'parent1',
@@ -133,6 +138,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
       {
         label: 'parent2',
@@ -141,6 +147,7 @@ describe('build', () => {
         target: '_self',
         type: MENU_LINK_TYPE.EXTERNAL,
         active: false,
+        endOfSubsection: false,
       },
     ])
   })