Fix Client Config async loading (#12308)
Fix ClientConfig async loading --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { downloadFile } from '../downloadFile';
|
||||
|
||||
// Mock fetch
|
||||
global.fetch = jest.fn(() =>
|
||||
Promise.resolve({
|
||||
status: 200,
|
||||
@ -16,13 +15,10 @@ 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"]',
|
||||
);
|
||||
@ -32,10 +28,8 @@ describe.skip('downloadFile', () => {
|
||||
// @ts-ignore
|
||||
expect(link?.style?.display).toBe('none');
|
||||
|
||||
// Assert on element click
|
||||
expect(link).toHaveBeenCalledTimes(1);
|
||||
|
||||
// Clean up mocks
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user