Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sphilipse committed Oct 4, 2022
1 parent 4c72368 commit 07fa1c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ const DEFAULT_PIPELINE_VALUES = {
const DEFAULT_VALUES = {
canSetPipeline: true,
canUseMlInferencePipeline: false,
customPipelineData: undefined,
defaultPipelineValues: DEFAULT_PIPELINE_VALUES,
defaultPipelineValuesData: undefined,
hasIndexIngestionPipeline: false,
index: undefined,
indexName: '',
mlInferencePipelineProcessors: undefined,
pipelineName: DEFAULT_PIPELINE_VALUES.name,
pipelineState: DEFAULT_PIPELINE_VALUES,
showModal: false,
showAddMlInferencePipelineModal: false,
hasIndexIngestionPipeline: false,
showModal: false,
};

describe('PipelinesLogic', () => {
Expand Down Expand Up @@ -69,6 +72,7 @@ describe('PipelinesLogic', () => {
...connectorIndex,
connector: { ...connectorIndex.connector },
},
indexName: 'connector',
});
expect(flashSuccessToast).toHaveBeenCalled();
expect(PipelinesLogic.actions.fetchIndexApiSuccess).toHaveBeenCalledWith({
Expand All @@ -86,8 +90,9 @@ describe('PipelinesLogic', () => {
});
expect(PipelinesLogic.values).toEqual({
...DEFAULT_VALUES,
pipelineState: { ...DEFAULT_PIPELINE_VALUES, name: 'new_pipeline_name' },
hasIndexIngestionPipeline: true,
pipelineName: 'new_pipeline_name',
pipelineState: { ...DEFAULT_PIPELINE_VALUES, name: 'new_pipeline_name' },
});
});
describe('makeRequest', () => {
Expand Down Expand Up @@ -152,12 +157,14 @@ describe('PipelinesLogic', () => {
expect(PipelinesLogic.values).toEqual({
...DEFAULT_VALUES,
canUseMlInferencePipeline: true,
hasIndexIngestionPipeline: true,
index: {
...connectorIndex,
connector: { ...connectorIndex.connector, pipeline: newPipeline },
},
indexName: 'connector',
pipelineName: 'new_pipeline_name',
pipelineState: newPipeline,
hasIndexIngestionPipeline: true,
});
});
it('should not set configState if modal is open', () => {
Expand All @@ -172,6 +179,7 @@ describe('PipelinesLogic', () => {
...connectorIndex,
connector: { ...connectorIndex.connector, pipeline: newPipeline },
},
indexName: 'connector',
showModal: true,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ export const PipelinesLogic = kea<MakeLogicType<PipelinesValues, PipelinesAction
],
hasIndexIngestionPipeline: [
() => [selectors.pipelineName, selectors.defaultPipelineValues],
(pipelineState: IngestPipelineParams, defaultPipelineValues: IngestPipelineParams) =>
pipelineState.name !== defaultPipelineValues.name,
(pipelineName: string, defaultPipelineValues: IngestPipelineParams) =>
pipelineName !== defaultPipelineValues.name,
],
indexName: [
() => [selectors.index],
Expand Down

0 comments on commit 07fa1c3

Please sign in to comment.