Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Nad <[email protected]>
  • Loading branch information
olga-union committed Aug 16, 2022
1 parent 710f1f2 commit 7561808
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { makeNodeExecutionDynamicWorkflowQuery } from 'components/Workflow/workf
import { useQuery } from 'react-query';
import { createRef, useContext, useEffect, useRef, useState } from 'react';
import { NodeExecutionsByIdContext } from 'components/Executions/contexts';
import { checkForDynamicExeuctions } from 'components/common/utils';
import { checkForDynamicExecutions } from 'components/common/utils';
import { convertToPlainNodes } from './helpers';
import { ChartHeader } from './chartHeader';
import { useScaleContext } from './scaleContext';
Expand Down Expand Up @@ -93,7 +93,7 @@ export const ExecutionTimeline: React.FC<ExProps> = ({ chartTimezone }) => {

const nodeExecutionsById = useContext(NodeExecutionsByIdContext);

const dynamicParents = checkForDynamicExeuctions(nodeExecutionsById, staticExecutionIdsMap);
const dynamicParents = checkForDynamicExecutions(nodeExecutionsById, staticExecutionIdsMap);

const { data: dynamicWorkflows } = useQuery(
makeNodeExecutionDynamicWorkflowQuery(dynamicParents),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ThemeProvider from '@material-ui/styles/ThemeProvider';
import { render, waitFor } from '@testing-library/react';
import { NodeExecutionsByIdContext } from 'components/Executions/contexts';
import { muiTheme } from 'components/Theme/muiTheme';
import { oneFailedTaskWorkflow } from 'mocks/data/fixtures/oneFailedTaskWorkflow';
import { insertFixture } from 'mocks/data/insertFixture';
Expand All @@ -16,6 +17,10 @@ jest.mock('../ExecutionWorkflowGraph.tsx', () => ({
ExecutionWorkflowGraph: () => null,
}));

jest.mock('../Timeline/ExecutionTimeline.tsx', () => ({
ExecutionTimeline: () => null,
}));

jest.mock('chart.js', () => ({
Chart: { register: () => null },
Tooltip: { positioners: { cursor: () => null } },
Expand Down Expand Up @@ -59,7 +64,9 @@ describe('ExecutionDetails > Timeline', () => {
render(
<ThemeProvider theme={muiTheme}>
<QueryClientProvider client={queryClient}>
<ExecutionNodesTimeline />
<NodeExecutionsByIdContext.Provider value={{}}>
<ExecutionNodesTimeline />
</NodeExecutionsByIdContext.Provider>
</QueryClientProvider>
</ThemeProvider>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { CompiledNode } from 'models/Node/types';
import { TaskExecutionPhase } from 'models/Execution/enums';
import { NodeExecutionsByIdContext } from 'components/Executions/contexts';
import { useContext } from 'react';
import { checkForDynamicExeuctions } from 'components/common/utils';
import { checkForDynamicExecutions } from 'components/common/utils';
import { transformerWorkflowToDag } from './transformerWorkflowToDag';

export interface WorkflowGraphProps {
Expand Down Expand Up @@ -70,7 +70,7 @@ export const WorkflowGraph: React.FC<WorkflowGraphProps> = (props) => {
const nodeExecutionsById = useContext(NodeExecutionsByIdContext);
const { dag, staticExecutionIdsMap, error } = workflowToDag(workflow);

const dynamicParents = checkForDynamicExeuctions(nodeExecutionsById, staticExecutionIdsMap);
const dynamicParents = checkForDynamicExecutions(nodeExecutionsById, staticExecutionIdsMap);
const dynamicWorkflowQuery = useQuery(makeNodeExecutionDynamicWorkflowQuery(dynamicParents));
const renderReactFlowGraph = (dynamicWorkflows) => {
debug('DynamicWorkflows:', dynamicWorkflows);
Expand Down
2 changes: 1 addition & 1 deletion packages/zapp/console/src/components/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function measureText(fontDefinition: string, text: string) {
* those executions into the dag by using the executions 'uniqueParentId'
* to render that node as a subworkflow
*/
export const checkForDynamicExeuctions = (allExecutions, staticExecutions) => {
export const checkForDynamicExecutions = (allExecutions, staticExecutions) => {
const parentsToFetch = {};
for (const executionId in allExecutions) {
if (!staticExecutions[executionId]) {
Expand Down

0 comments on commit 7561808

Please sign in to comment.