Revert "Client config not render blocking (#12300)" (#12302)

This reverts commit 4ce7fc6987, to take
more time to address PR comments
This commit is contained in:
Félix Malfait
2025-05-27 09:04:47 +02:00
committed by GitHub
parent e8532faaaa
commit 9cdd0fdac0
18 changed files with 148 additions and 776 deletions

View File

@ -1,5 +1,6 @@
import { downloadFile } from '../downloadFile';
// Mock fetch
global.fetch = jest.fn(() =>
Promise.resolve({
status: 200,
@ -15,10 +16,13 @@ window.URL.revokeObjectURL = jest.fn();
// `global.fetch` and `window.fetch` are also undefined
describe.skip('downloadFile', () => {
it('should download a file', () => {
// Call downloadFile
downloadFile('url/to/file.pdf', 'file.pdf');
// Assert on fetch
expect(fetch).toHaveBeenCalledWith('url/to/file.pdf');
// Assert on element creation
const link = document.querySelector(
'a[href="mock-url"][download="file.pdf"]',
);
@ -28,8 +32,10 @@ describe.skip('downloadFile', () => {
// @ts-ignore
expect(link?.style?.display).toBe('none');
// Assert on element click
expect(link).toHaveBeenCalledTimes(1);
// Clean up mocks
jest.clearAllMocks();
});
});