From 15c30a28f8c2c86de1bdb7be47c2b9b0d5b40870 Mon Sep 17 00:00:00 2001 From: Quentin Date: Thu, 7 Nov 2024 22:50:23 +0100 Subject: [PATCH] Sonar: Fix - refactor this code to not nest functions more than 4 levels deep --- .../primary/landscape/LandscapeComponent.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/webapp/unit/module/primary/landscape/LandscapeComponent.spec.ts b/src/test/webapp/unit/module/primary/landscape/LandscapeComponent.spec.ts index d9c91f66d69..bf99fbc7275 100644 --- a/src/test/webapp/unit/module/primary/landscape/LandscapeComponent.spec.ts +++ b/src/test/webapp/unit/module/primary/landscape/LandscapeComponent.spec.ts @@ -1246,14 +1246,14 @@ describe('Landscape', () => { await performSearch(searchInput, 'not-found'); const landscape = defaultLandscape(); - landscape.standaloneLevels().forEach(level => { - level.elements.forEach(element => { - element.allModules().forEach(module => { - const moduleClasses = wrapper.find(wrappedElement(`${module.slugString()}-module`)).classes(); - expect(moduleClasses).not.toContain('-search-highlighted'); - }); + landscape + .standaloneLevels() + .flatMap(level => level.elements) + .flatMap(element => element.allModules()) + .forEach(module => { + const moduleClasses = wrapper.find(wrappedElement(`${module.slugString()}-module`)).classes(); + expect(moduleClasses).not.toContain('-search-highlighted'); }); - }); }); it('should scroll vertically and horizontally to the highlighted module if it is not visible within the current viewport', async () => {