feat: add parallel test case
This commit is contained in:
parent
566dc9b4a8
commit
ab66f30e1d
@ -0,0 +1,39 @@
|
|||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import format from '.'
|
||||||
|
import graphToLogStruct from '../graph-to-log-struct'
|
||||||
|
|
||||||
|
describe('parallel', () => {
|
||||||
|
const list = graphToLogStruct('(parallel, parallelNode, nodeA, nodeB -> nodeC)')
|
||||||
|
const [parallelNode, ...parallelDetail] = list
|
||||||
|
const parallelI18n = 'PARALLEL'
|
||||||
|
// format will change the list...
|
||||||
|
const result = format(cloneDeep(list) as any, () => parallelI18n)
|
||||||
|
|
||||||
|
test('parallel should put nodes in details', () => {
|
||||||
|
expect(result as any).toEqual([
|
||||||
|
{
|
||||||
|
...parallelNode,
|
||||||
|
parallelDetail: {
|
||||||
|
isParallelStartNode: true,
|
||||||
|
parallelTitle: `${parallelI18n}-1`,
|
||||||
|
children: [
|
||||||
|
parallelNode,
|
||||||
|
{
|
||||||
|
...parallelDetail[0],
|
||||||
|
parallelDetail: {
|
||||||
|
branchTitle: `${parallelI18n}-1-A`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...parallelDetail[1],
|
||||||
|
parallelDetail: {
|
||||||
|
branchTitle: `${parallelI18n}-1-B`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
parallelDetail[2],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@ -5,7 +5,7 @@ describe('retry', () => {
|
|||||||
// retry nodeId:1 3 times.
|
// retry nodeId:1 3 times.
|
||||||
const steps = graphToLogStruct('start -> (retry, retryNode, 3)')
|
const steps = graphToLogStruct('start -> (retry, retryNode, 3)')
|
||||||
const [startNode, retryNode, ...retryDetail] = steps
|
const [startNode, retryNode, ...retryDetail] = steps
|
||||||
const result = format(steps)
|
const result = format(steps as any)
|
||||||
test('should have no retry status nodes', () => {
|
test('should have no retry status nodes', () => {
|
||||||
expect(result.find(item => (item as any).status === 'retry')).toBeUndefined()
|
expect(result.find(item => (item as any).status === 'retry')).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user