From acff7698fcce5070fd36dbda9ef187391fdf0cdf Mon Sep 17 00:00:00 2001 From: Mikko Riippi Date: Mon, 27 Apr 2026 17:37:08 +0300 Subject: [PATCH 1/2] fix: tell sonar to skip two lines Refs: KEH-191 --- src/utils/testUtils.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/testUtils.tsx b/src/utils/testUtils.tsx index 45ea5dfa..05fe964f 100644 --- a/src/utils/testUtils.tsx +++ b/src/utils/testUtils.tsx @@ -143,11 +143,11 @@ const actWait = (amount?: number): Promise => act(() => wait(amount)); const mockNumberString = (size: number): string => [...Array(size)] - .map(() => Math.floor(Math.random() * 10).toString()) + .map(() => Math.floor(Math.random() * 10).toString()) // NOSONAR .join(''); const mockString = (size: number): string => - [...Array(size)].map(() => Math.random().toString(36)[2]).join(''); + [...Array(size)].map(() => Math.random().toString(36)[2]).join(''); // NOSONAR const loadingSpinnerIsNotInDocument = async (timeout = 1000): Promise => waitFor( From e0e2e81d10b31a27f602325ce250bacefcc64d28 Mon Sep 17 00:00:00 2001 From: Mikko Riippi Date: Tue, 28 Apr 2026 07:16:42 +0300 Subject: [PATCH 2/2] fix: fix unit test Refs: KEH-191 --- src/domain/singups/__mocks__/testUtils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/domain/singups/__mocks__/testUtils.ts b/src/domain/singups/__mocks__/testUtils.ts index 98fbd857..c6c56828 100644 --- a/src/domain/singups/__mocks__/testUtils.ts +++ b/src/domain/singups/__mocks__/testUtils.ts @@ -49,7 +49,12 @@ export const shouldExportSignupsAsExcel = async ( // Mock document.createElement which is needed by downloadBlob. RenderComponent needs // createElement so do this after rendering components to avoid errors const createElement = document.createElement; - document.createElement = vi.fn().mockImplementation(() => link); + document.createElement = vi + .fn() + .mockImplementation((tagName: string, ...args: any[]) => { + if (tagName === 'a') return link; + return createElement.call(document, tagName, ...args); + }); await user.click(exportAsExcelButton);