Merge pull request #11097 from nixocio/ui_issue_11061

Fix worfklow node info
This commit is contained in:
Sarah Akus 2021-09-21 14:35:52 -04:00 committed by GitHub
commit 51b45c4fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 4 deletions

View File

@ -190,16 +190,19 @@ function NodeViewModal({ readOnly }) {
let nodeUpdatedConvergence = {};
if (
nodeToView.all_parents_must_converge !== undefined &&
nodeToView.all_parents_must_converge !==
nodeToView.originalNodeObject.all_parents_must_converge
nodeToView?.all_parents_must_converge !== undefined &&
nodeToView?.all_parents_must_converge !==
nodeToView?.originalNodeObject?.all_parents_must_converge
) {
nodeUpdatedConvergence = {
...nodeToView.originalNodeObject,
all_parents_must_converge: nodeToView.all_parents_must_converge,
};
} else {
nodeUpdatedConvergence = nodeToView.originalNodeObject;
nodeUpdatedConvergence = {
...nodeToView.originalNodeObject,
all_parents_must_converge: nodeToView?.all_parents_must_converge,
};
}
Content = (

View File

@ -300,4 +300,35 @@ describe('NodeViewModal', () => {
jest.clearAllMocks();
});
});
describe('Convergence label', () => {
const workflowContext = {
nodeToView: {
fullUnifiedJobTemplate: {
id: 1,
name: 'Mock Node',
description: '',
type: 'workflow_approval_template',
timeout: 0,
all_parents_must_converge: false,
},
},
};
test('should display "Any" Convergence label', async () => {
let wrapper;
await act(async () => {
wrapper = mountWithContexts(
<WorkflowDispatchContext.Provider value={dispatch}>
<WorkflowStateContext.Provider value={workflowContext}>
<NodeViewModal />
</WorkflowStateContext.Provider>
</WorkflowDispatchContext.Provider>
);
});
waitForLoaded(wrapper);
expect(wrapper.find('Detail[label="Convergence"] dd').text()).toBe('Any');
jest.clearAllMocks();
});
});
});