Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Sep 6, 2022
1 parent f880b7a commit 42e1b18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { registerConnectorsToMockActionRegistry } from '../../common/mock/regist
import { createStartServicesMock } from '../../common/lib/kibana/kibana_react.mock';
import { waitForComponentToUpdate } from '../../common/test_utils';
import { useCreateAttachments } from '../../containers/use_create_attachments';
import { useFindAssignees } from '../../containers/use_find_assignees';
import { useGetCasesMetrics } from '../../containers/use_get_cases_metrics';
import { useGetConnectors } from '../../containers/configure/use_connectors';
import { useGetTags } from '../../containers/use_get_tags';
Expand All @@ -55,7 +54,6 @@ jest.mock('../../containers/use_get_cases_status');
jest.mock('../../containers/use_get_cases_metrics');
jest.mock('../../containers/use_get_action_license');
jest.mock('../../containers/use_get_tags');
jest.mock('../../containers/use_find_assignees');
jest.mock('../../containers/user_profiles/use_get_current_user_profile');
jest.mock('../../containers/user_profiles/use_bulk_get_user_profiles');
jest.mock('../../containers/configure/use_connectors');
Expand All @@ -72,7 +70,6 @@ const useGetCasesStatusMock = useGetCasesStatus as jest.Mock;
const useGetCasesMetricsMock = useGetCasesMetrics as jest.Mock;
const useUpdateCasesMock = useUpdateCases as jest.Mock;
const useGetTagsMock = useGetTags as jest.Mock;
const useFindAssigneesMock = useFindAssignees as jest.Mock;
const useGetCurrentUserProfileMock = useGetCurrentUserProfile as jest.Mock;
const useBulkGetUserProfilesMock = useBulkGetUserProfiles as jest.Mock;
const useKibanaMock = useKibana as jest.MockedFunction<typeof useKibana>;
Expand Down Expand Up @@ -173,11 +170,6 @@ describe('AllCasesListGeneric', () => {
useGetCasesStatusMock.mockReturnValue(defaultCasesStatus);
useGetCasesMetricsMock.mockReturnValue(defaultCasesMetrics);
useGetTagsMock.mockReturnValue({ data: ['coke', 'pepsi'], refetch: jest.fn() });
useFindAssigneesMock.mockReturnValue({
data: userProfiles,
refetch: jest.fn(),
isLoading: false,
});
useGetCurrentUserProfileMock.mockReturnValue({ data: userProfiles[0], isLoading: false });
useBulkGetUserProfilesMock.mockReturnValue({ data: userProfilesMap });
useGetConnectorsMock.mockImplementation(() => ({ data: connectorsMock, isLoading: false }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { useGetCases } from '../../containers/use_get_cases';
import { useGetCurrentUserProfile } from '../../containers/user_profiles/use_get_current_user_profile';
import { userProfiles, userProfilesMap } from '../../containers/user_profiles/api.mock';
import { useBulkGetUserProfiles } from '../../containers/user_profiles/use_bulk_get_user_profiles';
import { useFindAssignees } from '../../containers/use_find_assignees';

jest.mock('../../containers/use_get_tags');
jest.mock('../../containers/use_get_action_license', () => {
Expand All @@ -37,15 +36,13 @@ jest.mock('../../containers/configure/use_connectors');
jest.mock('../../containers/api');
jest.mock('../../containers/use_get_cases');
jest.mock('../../containers/use_get_cases_status');
jest.mock('../../containers/use_find_assignees');
jest.mock('../../containers/user_profiles/use_get_current_user_profile');
jest.mock('../../containers/user_profiles/use_bulk_get_user_profiles');

const useGetConnectorsMock = useGetConnectors as jest.Mock;
const useGetCasesMock = useGetCases as jest.Mock;
const useGetCasesStatusMock = useGetCasesStatus as jest.Mock;
const useGetActionLicenseMock = useGetActionLicense as jest.Mock;
const useFindAssigneesMock = useFindAssignees as jest.Mock;
const useGetCurrentUserProfileMock = useGetCurrentUserProfile as jest.Mock;
const useBulkGetUserProfilesMock = useBulkGetUserProfiles as jest.Mock;

Expand Down Expand Up @@ -83,11 +80,7 @@ describe('AllCases', () => {
useGetCasesStatusMock.mockReturnValue(defaultCasesStatus);
useGetActionLicenseMock.mockReturnValue(defaultActionLicense);
useGetCasesMock.mockReturnValue(defaultGetCases);
useFindAssigneesMock.mockReturnValue({
data: userProfiles,
refetch: jest.fn(),
isLoading: false,
});

useGetCurrentUserProfileMock.mockReturnValue({ data: userProfiles[0], isLoading: false });
useBulkGetUserProfilesMock.mockReturnValue({ data: userProfilesMap });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { AppMockRenderer, createAppMockRenderer, TestProviders } from '../../com
import { DEFAULT_FILTER_OPTIONS } from '../../containers/use_get_cases';
import { CasesTableFilters } from './table_filters';
import { useGetTags } from '../../containers/use_get_tags';
import { useFindAssignees } from '../../containers/use_find_assignees';
import { useSuggestUserProfiles } from '../../containers/user_profiles/use_suggest_user_profiles';
import { userProfiles } from '../../containers/user_profiles/api.mock';

jest.mock('../../containers/use_find_assignees');
jest.mock('../../containers/use_get_tags');
jest.mock('../../containers/user_profiles/use_suggest_user_profiles');

const onFilterChanged = jest.fn();
const refetch = jest.fn();
Expand All @@ -45,11 +45,7 @@ describe('CasesTableFilters ', () => {
appMockRender = createAppMockRenderer();
jest.clearAllMocks();
(useGetTags as jest.Mock).mockReturnValue({ data: ['coke', 'pepsi'], refetch });
(useFindAssignees as jest.Mock).mockReturnValue({
data: userProfiles,
refetch,
isLoading: false,
});
(useSuggestUserProfiles as jest.Mock).mockReturnValue({ data: userProfiles, isLoading: false });
});

it('should render the case status filter dropdown', () => {
Expand Down

0 comments on commit 42e1b18

Please sign in to comment.