Skip to content

Commit

Permalink
[Security Solution] Security Assistant: updates mocks (elastic#20)
Browse files Browse the repository at this point in the history
## Summary

- updates mocks to fix Jest tests
  • Loading branch information
andrew-goldstein authored Jun 2, 2023
1 parent 71f0da8 commit ff5d0dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ const KibanaReactContext = createKibanaReactContext(coreMock);
*/
export const StorybookProviders: React.FC = ({ children }) => {
const store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const http = httpServiceMock.createStartContract({ basePath: '/test' });
const actionTypeRegistry = actionTypeRegistryMock.create();
const mockGetInitialConversations = jest.fn(() => ({}));
const mockGetComments = jest.fn(() => []);
const mockHttp = httpServiceMock.createStartContract({ basePath: '/test' });

return (
<I18nProvider>
Expand All @@ -67,10 +69,10 @@ export const StorybookProviders: React.FC = ({ children }) => {
<AssistantProvider
actionTypeRegistry={actionTypeRegistry}
augmentMessageCodeBlocks={jest.fn()}
getComments={jest.fn()}
getInitialConversations={jest.fn()}
http={http}
getComments={mockGetComments}
getInitialConversations={mockGetInitialConversations}
setConversations={jest.fn()}
http={mockHttp}
>
{children}
</AssistantProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ export const TestProvidersComponent: React.FC<Props> = ({
cellActions = [],
}) => {
const queryClient = new QueryClient();
const http = httpServiceMock.createStartContract({ basePath: '/test' });
const actionTypeRegistry = actionTypeRegistryMock.create();
const mockGetInitialConversations = jest.fn(() => ({}));
const mockGetComments = jest.fn(() => []);
const mockHttp = httpServiceMock.createStartContract({ basePath: '/test' });

return (
<I18nProvider>
Expand All @@ -75,10 +77,10 @@ export const TestProvidersComponent: React.FC<Props> = ({
<AssistantProvider
actionTypeRegistry={actionTypeRegistry}
augmentMessageCodeBlocks={jest.fn()}
getComments={jest.fn()}
getInitialConversations={jest.fn()}
http={http}
getComments={mockGetComments}
getInitialConversations={mockGetInitialConversations}
setConversations={jest.fn()}
http={mockHttp}
>
<QueryClientProvider client={queryClient}>
<ExpandableFlyoutProvider>
Expand Down Expand Up @@ -109,8 +111,10 @@ const TestProvidersWithPrivilegesComponent: React.FC<Props> = ({
onDragEnd = jest.fn(),
cellActions = [],
}) => {
const http = httpServiceMock.createStartContract({ basePath: '/test' });
const actionTypeRegistry = actionTypeRegistryMock.create();
const mockGetInitialConversations = jest.fn(() => ({}));
const mockGetComments = jest.fn(() => []);
const mockHttp = httpServiceMock.createStartContract({ basePath: '/test' });

return (
<I18nProvider>
Expand All @@ -120,10 +124,10 @@ const TestProvidersWithPrivilegesComponent: React.FC<Props> = ({
<AssistantProvider
actionTypeRegistry={actionTypeRegistry}
augmentMessageCodeBlocks={jest.fn()}
getComments={jest.fn()}
getInitialConversations={jest.fn()}
http={http}
getComments={mockGetComments}
getInitialConversations={mockGetInitialConversations}
setConversations={jest.fn()}
http={mockHttp}
>
<UserPrivilegesProvider
kibanaCapabilities={
Expand Down

0 comments on commit ff5d0dd

Please sign in to comment.