wwf
22 小时以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import format from '.'
import graphToLogStruct from '../graph-to-log-struct'
import { noop } from 'lodash-es'
 
describe('loop', () => {
  const list = graphToLogStruct('start -> (loop, loopNode, plainNode1 -> plainNode2)')
  const [startNode, loopNode, ...loops] = list
  const result = format(list as any, noop)
  test('result should have no nodes in loop node', () => {
    expect(result.find(item => !!item.execution_metadata?.loop_id)).toBeUndefined()
  })
  test('loop should put nodes in details', () => {
    expect(result).toEqual([
      startNode,
      {
        ...loopNode,
        details: [
          [loops[0], loops[1]],
        ],
      },
    ])
  })
})