Skip to content

Commit

Permalink
[APM] Add missing IntlProvider to unit test (#150137)
Browse files Browse the repository at this point in the history
Jest tests in APM are currently failing with:

```
Error: Uncaught [Error: [React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry. Using default message as fallback.]
```

Adding the `IntlProvider` fixes the problem
  • Loading branch information
sorenlouv authored Feb 2, 2023
1 parent 4a1373c commit 5aafc55
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from '../../../utils/test_helpers';
import { fromQuery } from '../../shared/links/url_helpers';
import { TransactionOverview } from '.';
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';

const KibanaReactContext = createKibanaReactContext({
uiSettings: { get: () => true },
Expand Down Expand Up @@ -64,15 +65,17 @@ function setup({
jest.spyOn(useFetcherHook, 'useFetcher').mockReturnValue({} as any);

return renderWithTheme(
<KibanaReactContext.Provider>
<MockApmPluginContextWrapper history={history}>
<UrlParamsProvider>
<ApmServiceContextProvider>
<TransactionOverview />
</ApmServiceContextProvider>
</UrlParamsProvider>
</MockApmPluginContextWrapper>
</KibanaReactContext.Provider>
<IntlProvider locale="en">
<KibanaReactContext.Provider>
<MockApmPluginContextWrapper history={history}>
<UrlParamsProvider>
<ApmServiceContextProvider>
<TransactionOverview />
</ApmServiceContextProvider>
</UrlParamsProvider>
</MockApmPluginContextWrapper>
</KibanaReactContext.Provider>
</IntlProvider>
);
}

Expand Down

0 comments on commit 5aafc55

Please sign in to comment.