Skip to content

Commit

Permalink
Fix endless looping in test util
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Oct 29, 2024
1 parent c9df6f1 commit d454c7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions public/pages/workflow_detail/workflow_detail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ describe('WorkflowDetail Page with skip ingestion option (Hybrid Search Workflow
expect(getAllByText('PROCESSORS').length).toBeGreaterThan(0);
});

// Save, Build and Run query, Back buttons
expect(getByTestId('saveSearchPipelineButton')).toBeInTheDocument();
// Build and Run query, Back buttons are present
expect(getByTestId('runQueryButton')).toBeInTheDocument();
const searchPipelineBackButton = getByTestId('searchPipelineBackButton');
userEvent.click(searchPipelineBackButton);
Expand Down
14 changes: 6 additions & 8 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../public/store';
import { WorkflowInput } from '../test/interfaces';
import { WORKFLOW_TYPE } from '../common/constants';
import { UIState, Workflow } from '../common/interfaces';
import { UIState, Workflow, WorkflowDict } from '../common/interfaces';
import {
fetchEmptyMetadata,
fetchHybridSearchMetadata,
Expand All @@ -22,19 +22,17 @@ import fs from 'fs';
import path from 'path';

export function mockStore(...workflowSets: WorkflowInput[]) {
let workflowDict = {} as WorkflowDict;
workflowSets?.forEach((workflowInput) => {
workflowDict[workflowInput.id] = generateWorkflow(workflowInput);
});
return {
getState: () => ({
opensearch: INITIAL_OPENSEARCH_STATE,
ml: INITIAL_ML_STATE,
workflows: {
...INITIAL_WORKFLOWS_STATE,
workflows: workflowSets.reduce(
(acc, workflowInput) => ({
...acc,
[workflowInput.id]: generateWorkflow(workflowInput),
}),
{}
),
workflows: workflowDict,
},
presets: INITIAL_PRESETS_STATE,
}),
Expand Down

0 comments on commit d454c7c

Please sign in to comment.