Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme committed Jun 20, 2023
1 parent d73c16d commit 2b5e89d
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { render } from '../../utils/test_helper';
import { useKibana } from '../../utils/kibana_react';
import { useLicense } from '../../hooks/use_license';
import { useFetchIndices } from '../../hooks/use_fetch_indices';
import { useFetchDataViews } from '../../hooks/use_fetch_data_views';
import { useFetchSloDetails } from '../../hooks/slo/use_fetch_slo_details';
import { useCreateSlo } from '../../hooks/slo/use_create_slo';
import { useUpdateSlo } from '../../hooks/slo/use_update_slo';
Expand All @@ -34,6 +35,7 @@ jest.mock('react-router-dom', () => ({
jest.mock('@kbn/observability-shared-plugin/public');
jest.mock('../../hooks/use_license');
jest.mock('../../hooks/use_fetch_indices');
jest.mock('../../hooks/use_fetch_data_views');
jest.mock('../../hooks/slo/use_fetch_slo_details');
jest.mock('../../hooks/slo/use_create_slo');
jest.mock('../../hooks/slo/use_update_slo');
Expand All @@ -49,6 +51,7 @@ jest.mock('../../utils/kibana_react', () => ({
const useKibanaMock = useKibana as jest.Mock;
const useLicenseMock = useLicense as jest.Mock;
const useFetchIndicesMock = useFetchIndices as jest.Mock;
const useFetchDataViewsMock = useFetchDataViews as jest.Mock;
const useFetchSloMock = useFetchSloDetails as jest.Mock;
const useCreateSloMock = useCreateSlo as jest.Mock;
const useUpdateSloMock = useUpdateSlo as jest.Mock;
Expand Down Expand Up @@ -147,8 +150,9 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});
useFetchDataViewsMock.mockReturnValue({ isLoading: false, data: [] });

useCreateSloMock.mockReturnValue({
isLoading: false,
Expand Down Expand Up @@ -179,6 +183,7 @@ describe('SLO Edit Page', () => {
hasReadCapabilities: true,
});
useLicenseMock.mockReturnValue({ hasAtLeast: () => true });
useFetchDataViewsMock.mockReturnValue({ isLoading: false, data: [] });
});

describe('with no write permission', () => {
Expand All @@ -199,7 +204,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -235,7 +240,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -278,7 +283,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useFetchSloMock.mockReturnValue({ isLoading: false, slo: undefined });
Expand Down Expand Up @@ -380,7 +385,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -430,7 +435,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -491,7 +496,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useFetchSloMock.mockReturnValue({ isLoading: false, slo });
Expand Down Expand Up @@ -544,7 +549,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -609,7 +614,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -650,7 +655,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down Expand Up @@ -695,7 +700,7 @@ describe('SLO Edit Page', () => {

useFetchIndicesMock.mockReturnValue({
isLoading: false,
indices: [{ name: 'some-index' }],
data: ['some-index'],
});

useCreateSloMock.mockReturnValue({
Expand Down

0 comments on commit 2b5e89d

Please sign in to comment.