Skip to content

Commit

Permalink
fix(link-event): fix false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Aug 25, 2023
1 parent bb56cf7 commit b069da7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rules/camunda-cloud/link-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ module.exports = skipInNonExecutableProcess(function() {

const name = linkEventDefinition.get('name');

names = [
...names,
name
];

if (!name) {
return {
duplicateNames,
names
};
}

names = [
...names,
name
];

if (names.indexOf(name) !== index && !duplicateNames.includes(name)) {
duplicateNames = [
...duplicateNames,
Expand Down
26 changes: 26 additions & 0 deletions test/camunda-cloud/link-event.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,32 @@ const invalid = [
requiredProperty: 'name'
},
}
},
{
name: 'link catch events (missing name, no duplicate name)',
moddleElement: createModdle(createProcess(`
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn:linkEventDefinition id="LinkEventDefinition_1" />
</bpmn:intermediateCatchEvent>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_2">
<bpmn:linkEventDefinition id="LinkEventDefinition_2" name="foo" />
</bpmn:intermediateCatchEvent>
`)),
report: {
id: 'IntermediateCatchEvent_1',
message: 'Element of type <bpmn:LinkEventDefinition> must have property <name>',
path: [
'eventDefinitions',
0,
'name'
],
data: {
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'LinkEventDefinition_1',
parentNode: 'IntermediateCatchEvent_1',
requiredProperty: 'name'
},
}
}
];

Expand Down

0 comments on commit b069da7

Please sign in to comment.