@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- import { ShapeBpmnElementKind , ShapeUtil } from '@lib/model/bpmn/internal' ;
17+ import { FlowKind , ShapeBpmnElementKind , ShapeUtil } from '@lib/model/bpmn/internal' ;
1818
1919describe ( 'ShapeUtil' , ( ) => {
2020 it ( 'top level bpmn event kinds' , ( ) => {
@@ -29,6 +29,14 @@ describe('ShapeUtil', () => {
2929 expect ( tasks ) . toContain ( ShapeBpmnElementKind . TASK_USER ) ;
3030 } ) ;
3131
32+ it ( 'flow node kinds' , ( ) => {
33+ const flowNodeKinds = ShapeUtil . flowNodeKinds ( ) ;
34+ expect ( flowNodeKinds ) . toContain ( ShapeBpmnElementKind . TASK ) ;
35+ expect ( flowNodeKinds ) . toContain ( ShapeBpmnElementKind . EVENT_INTERMEDIATE_CATCH ) ;
36+ expect ( flowNodeKinds ) . toContain ( ShapeBpmnElementKind . GROUP ) ; // artifact should not be included
37+ expect ( flowNodeKinds ) . not . toContain ( ShapeBpmnElementKind . POOL ) ;
38+ } ) ;
39+
3240 describe ( 'Is pool or lane?' , ( ) => {
3341 it . each ( [
3442 [ ShapeBpmnElementKind . CALL_ACTIVITY ] ,
@@ -46,6 +54,46 @@ describe('ShapeUtil', () => {
4654 } ) ;
4755 } ) ;
4856
57+ describe ( 'isArtifact' , ( ) => {
58+ test . each `
59+ kind | expected
60+ ${ ShapeBpmnElementKind . EVENT_END } | ${ false }
61+ ${ ShapeBpmnElementKind . GATEWAY_PARALLEL } | ${ false }
62+ ${ ShapeBpmnElementKind . TASK } | ${ false }
63+ ${ ShapeBpmnElementKind . SUB_PROCESS } | ${ false }
64+ ${ ShapeBpmnElementKind . CALL_ACTIVITY } | ${ false }
65+ ${ ShapeBpmnElementKind . POOL } | ${ false }
66+ ${ ShapeBpmnElementKind . LANE } | ${ false }
67+ ${ ShapeBpmnElementKind . GROUP } | ${ true }
68+ ${ ShapeBpmnElementKind . TEXT_ANNOTATION } | ${ true }
69+ ${ FlowKind . MESSAGE_FLOW } | ${ false }
70+ ${ 'unknown' } | ${ false }
71+ ${ 'receiveTask' } | ${ false }
72+ ` ( '$kind isArtifact? $expected' , ( { kind, expected } : Record < string , unknown > ) => {
73+ expect ( ShapeUtil . isArtifact ( kind as string ) ) . toBe ( expected ) ;
74+ } ) ;
75+ } ) ;
76+
77+ describe ( 'isFlowNode' , ( ) => {
78+ test . each `
79+ kind | expected
80+ ${ ShapeBpmnElementKind . EVENT_END } | ${ true }
81+ ${ ShapeBpmnElementKind . GATEWAY_PARALLEL } | ${ true }
82+ ${ ShapeBpmnElementKind . TASK } | ${ true }
83+ ${ ShapeBpmnElementKind . SUB_PROCESS } | ${ true }
84+ ${ ShapeBpmnElementKind . CALL_ACTIVITY } | ${ true }
85+ ${ ShapeBpmnElementKind . POOL } | ${ false }
86+ ${ ShapeBpmnElementKind . LANE } | ${ false }
87+ ${ ShapeBpmnElementKind . GROUP } | ${ true }
88+ ${ ShapeBpmnElementKind . TEXT_ANNOTATION } | ${ true }
89+ ${ FlowKind . MESSAGE_FLOW } | ${ false }
90+ ${ 'unknown' } | ${ false }
91+ ${ 'receiveTask' } | ${ true }
92+ ` ( '$kind isFlowNode? $expected' , ( { kind, expected } : Record < string , unknown > ) => {
93+ expect ( ShapeUtil . isFlowNode ( kind as string ) ) . toBe ( expected ) ;
94+ } ) ;
95+ } ) ;
96+
4997 describe ( 'Reference kinds cannot be modified' , ( ) => {
5098 it . each `
5199 kind | kindsFunction
0 commit comments