chore: minor code enhancements

This commit is contained in:
Yiannis
2026-03-21 16:38:30 +02:00
parent c8b47a7922
commit 20682a543a
18 changed files with 115 additions and 103 deletions

View File

@@ -1,21 +1,21 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
const mockRemoveListener = jest.fn();
import { useItemListLazyLoad } from '../../../src/static/js/utils/hooks/useItemListLazyLoad';
let mockListHandler: any;
let addListItemsSpy = jest.fn();
jest.mock('../../../src/static/js/utils/settings/config', () => ({
config: jest.fn(() => jest.requireActual('../../tests-constants').sampleMediaCMSConfig),
}));
jest.mock('../../../src/static/js/utils/classes/', () => ({
BrowserCache: jest.fn().mockImplementation(() => ({
get: jest.fn(),
set: jest.fn(),
})),
BrowserCache: jest.fn().mockImplementation(() => ({ get: jest.fn(), set: jest.fn() })),
}));
let mockListHandler: any;
let addListItemsSpy = jest.fn();
const mockRemoveListener = jest.fn();
jest.mock('../../../src/static/js/utils/hooks/useItemList', () => ({
useItemList: (props: any, _ref: any) => {
mockListHandler = {
@@ -35,13 +35,7 @@ jest.mock('../../../src/static/js/utils/hooks/useItemList', () => ({
},
}));
jest.mock('../../../src/static/js/utils/stores/', () => ({
PageStore: {
removeListener: mockRemoveListener,
},
}));
import { useItemListLazyLoad } from '../../../src/static/js/utils/hooks/useItemListLazyLoad';
jest.mock('../../../src/static/js/utils/stores/', () => ({ PageStore: { removeListener: mockRemoveListener } }));
function HookConsumer(props: any) {
const tuple = useItemListLazyLoad(props);