From 258bf2453cadcd3b93f2bc08fd9e89b1dca92019 Mon Sep 17 00:00:00 2001 From: MariaAga Date: Mon, 18 Mar 2024 13:54:49 +0100 Subject: [PATCH] Fixes #37276 - test failing because of foreman context change --- webpack/testHelper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/webpack/testHelper.js b/webpack/testHelper.js index eab61e11..22560413 100644 --- a/webpack/testHelper.js +++ b/webpack/testHelper.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Provider } from 'react-redux'; import store from 'foremanReact/redux'; import { MockedProvider } from '@apollo/react-testing'; @@ -19,20 +19,21 @@ export const withRouter = Component => props => ( ); export const withMockedProvider = Component => props => { - const ForemanContext = getForemanContext(ctx); // eslint-disable-next-line react/prop-types const { mocks, ...rest } = props; - const ctx = { + const [context, setContext] = useState({ metadata: { UISettings: { perPage: 20, }, }, - }; + }); + const contextData = { context, setContext }; + const ForemanContext = getForemanContext(contextData); return ( - +