Skip to content

Commit

Permalink
fix: lint message end events
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme authored Oct 23, 2024
1 parent a8084c4 commit 346657b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rules/camunda-cloud/implementation/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = {
'bpmn:IntermediateThrowEvent': {
'bpmn:MessageEventDefinition': '1.2'
},
'bpmn:EndEvent': {
'bpmn:MessageEventDefinition': '1.2'
},
'bpmn:ScriptTask': '1.1',
'bpmn:SendTask': '1.1',
'bpmn:ServiceTask': '1.0'
Expand Down
60 changes: 60 additions & 0 deletions test/camunda-cloud/implementation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ const valid = [
</bpmn:intermediateThrowEvent>
`))
},
{
name: 'message end event (Camunda Cloud 1.2)',
config: { version: '1.2' },
moddleElement: createModdle(createProcess(`
<bpmn:endEvent id="EndEvent_1">
<bpmn:extensionElements>
<zeebe:taskDefinition type="foo" />
</bpmn:extensionElements>
<bpmn:messageEventDefinition id="MessageEventDefinition_1" />
</bpmn:endEvent>
`))
},
{
name: 'task (Camunda Cloud 1.2)',
config: { version: '1.2' },
Expand Down Expand Up @@ -302,6 +314,54 @@ const invalid = [
}
}
},
{
name: 'message end event (no task definition) (Camunda Cloud 1.2)',
config: { version: '1.2' },
moddleElement: createModdle(createProcess(`
<bpmn:endEvent id="EndEvent_1">
<bpmn:messageEventDefinition id="MessageEventDefinition_1" />
</bpmn:endEvent>
`)),
report: {
id: 'EndEvent_1',
message: 'Element of type <bpmn:EndEvent> must have one extension element of type <zeebe:TaskDefinition>',
path: [],
data: {
type: ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
node: 'EndEvent_1',
parentNode: null,
requiredExtensionElement: 'zeebe:TaskDefinition'
}
}
},
{
name: 'message end event (no task definition type) (Camunda Cloud 1.2)',
config: { version: '1.2' },
moddleElement: createModdle(createProcess(`
<bpmn:endEvent id="EndEvent_1">
<bpmn:extensionElements>
<zeebe:taskDefinition />
</bpmn:extensionElements>
<bpmn:messageEventDefinition id="MessageEventDefinition_1" />
</bpmn:endEvent>
`)),
report: {
id: 'EndEvent_1',
message: 'Element of type <zeebe:TaskDefinition> must have property <type>',
path: [
'extensionElements',
'values',
0,
'type'
],
data: {
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'zeebe:TaskDefinition',
parentNode: 'EndEvent_1',
requiredProperty: 'type'
}
}
},
{
name: 'service task (no task definition) (Camunda Cloud 1.3)',
config: { version: '1.3' },
Expand Down

0 comments on commit 346657b

Please sign in to comment.