Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/domain/singups/__mocks__/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/utils/testUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ const actWait = (amount?: number): Promise<void> => 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<void> =>
waitFor(
Expand Down
Loading