-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update node executions to display map tasks (#455)
* fix: update node executions to display map tasks * fix: update map task logs styles * test: add/update unit tests * fix: fix flickering and unnecessary re-renders Signed-off-by: Olga Nad <[email protected]>
- Loading branch information
1 parent
686f3cc
commit 7bed57e
Showing
20 changed files
with
1,031 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
.../console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/test/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { render } from '@testing-library/react'; | ||
import { useTabState } from 'components/hooks/useTabState'; | ||
import { extractTaskTemplates } from 'components/hooks/utils'; | ||
import { TaskExecutionPhase } from 'models/Execution/enums'; | ||
import { createMockNodeExecutions } from 'models/Execution/__mocks__/mockNodeExecutionsData'; | ||
import { TaskType } from 'models/Task/constants'; | ||
import { createMockWorkflow } from 'models/__mocks__/workflowData'; | ||
import * as React from 'react'; | ||
import { NodeExecutionTabs } from '../index'; | ||
|
||
const getMockNodeExecution = () => createMockNodeExecutions(1).executions[0]; | ||
const nodeExecution = getMockNodeExecution(); | ||
const workflow = createMockWorkflow('SampleWorkflow'); | ||
const taskTemplate = { ...extractTaskTemplates(workflow)[0], type: TaskType.ARRAY }; | ||
const phase = TaskExecutionPhase.SUCCEEDED; | ||
|
||
jest.mock('components/hooks/useTabState'); | ||
|
||
describe('NodeExecutionTabs', () => { | ||
const mockUseTabState = useTabState as jest.Mock<any>; | ||
mockUseTabState.mockReturnValue({ onChange: jest.fn(), value: 'executions' }); | ||
describe('with map tasks', () => { | ||
it('should display proper tab name when it was provided and shouldShow is TRUE', async () => { | ||
const { queryByText, queryAllByRole } = render( | ||
<NodeExecutionTabs | ||
nodeExecution={nodeExecution} | ||
shouldShowTaskDetails={true} | ||
phase={phase} | ||
taskTemplate={taskTemplate} | ||
/>, | ||
); | ||
expect(queryAllByRole('tab')).toHaveLength(4); | ||
expect(queryByText('Execution')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display proper tab name when it was provided and shouldShow is FALSE', async () => { | ||
const { queryByText, queryAllByRole } = render( | ||
<NodeExecutionTabs | ||
nodeExecution={nodeExecution} | ||
shouldShowTaskDetails={false} | ||
phase={phase} | ||
taskTemplate={taskTemplate} | ||
/>, | ||
); | ||
|
||
expect(queryAllByRole('tab')).toHaveLength(4); | ||
expect(queryByText('Map Execution')).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe('without map tasks', () => { | ||
it('should display proper tab name when mapTask was not provided', async () => { | ||
const { queryAllByRole, queryByText } = render( | ||
<NodeExecutionTabs nodeExecution={nodeExecution} shouldShowTaskDetails={false} />, | ||
); | ||
|
||
expect(queryAllByRole('tab')).toHaveLength(3); | ||
expect(queryByText('Executions')).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.