diff --git a/x-pack/plugins/cases/public/common/mock/test_providers.tsx b/x-pack/plugins/cases/public/common/mock/test_providers.tsx index aef1024cc8afc..257ac4b1f8293 100644 --- a/x-pack/plugins/cases/public/common/mock/test_providers.tsx +++ b/x-pack/plugins/cases/public/common/mock/test_providers.tsx @@ -89,22 +89,20 @@ const TestProvidersComponent: React.FC = ({ }); const getFilesClient = mockGetFilesClient(); + const casesProviderValue = { + externalReferenceAttachmentTypeRegistry, + persistableStateAttachmentTypeRegistry, + features, + owner, + permissions, + getFilesClient, + }; return ( - + {children} @@ -170,23 +168,20 @@ export const createAppMockRenderer = ({ }); const getFilesClient = mockGetFilesClient(); - + const casesProviderValue = { + externalReferenceAttachmentTypeRegistry, + persistableStateAttachmentTypeRegistry, + features, + owner, + permissions, + releasePhase, + getFilesClient, + }; const AppWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => ( - + {children} @@ -195,10 +190,11 @@ export const createAppMockRenderer = ({ ); AppWrapper.displayName = 'AppWrapper'; + const memoizedAppWrapper = React.memo(AppWrapper); const render: UiRender = (ui, options) => { return reactRender(ui, { - wrapper: AppWrapper, + wrapper: memoizedAppWrapper, ...options, }); }; diff --git a/x-pack/plugins/cases/public/components/all_cases/utility_bar.test.tsx b/x-pack/plugins/cases/public/components/all_cases/utility_bar.test.tsx index bd72a460c8c71..63d8cd2e5faab 100644 --- a/x-pack/plugins/cases/public/components/all_cases/utility_bar.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/utility_bar.test.tsx @@ -41,7 +41,17 @@ describe('Severity form field', () => { showClearFiltersButton: false, }; + beforeAll(() => { + jest.useFakeTimers(); + }); + + afterAll(() => { + jest.useRealTimers(); + sessionStorage.removeItem(localStorageKey); + }); + beforeEach(() => { + jest.useFakeTimers(); // Workaround for timeout via https://github.com/testing-library/user-event/issues/833#issuecomment-1171452841 user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime,