From ce3f2001ae07b87501b851462f7a0865b231028b Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Fri, 22 Nov 2024 15:14:43 +0100 Subject: [PATCH] fix: do not mark job worker user task as incorrect Related to https://github.com/camunda/camunda-modeler/issues/4718 --- rules/camunda-cloud/task-listener.js | 12 ++++++------ test/camunda-cloud/task-listener.spec.js | 14 +++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/rules/camunda-cloud/task-listener.js b/rules/camunda-cloud/task-listener.js index 2a8c468..6fa2fd0 100644 --- a/rules/camunda-cloud/task-listener.js +++ b/rules/camunda-cloud/task-listener.js @@ -17,18 +17,18 @@ module.exports = skipInNonExecutableProcess(function() { return; } - let errors = hasExtensionElement(node, 'zeebe:UserTask', node); - - if (errors && errors.length) { - reportErrors(node, reporter, errors); - } - const taskListeners = findExtensionElement(node, 'zeebe:TaskListeners'); if (!taskListeners) { return; } + let errors = hasExtensionElement(node, 'zeebe:UserTask'); + + if (errors && errors.length) { + reportErrors(node, reporter, errors); + } + const listeners = taskListeners.get('listeners'); errors = listeners.flatMap(listener => hasProperties(listener, { type: { diff --git a/test/camunda-cloud/task-listener.spec.js b/test/camunda-cloud/task-listener.spec.js index be539ef..be1b7e3 100644 --- a/test/camunda-cloud/task-listener.spec.js +++ b/test/camunda-cloud/task-listener.spec.js @@ -23,6 +23,13 @@ const valid = [ `)) + }, + { + name: 'job worker user task without tasklisteners', + config: { version: '8.7' }, + moddleElement: createModdle(createProcess(` + + `)) } ]; @@ -42,7 +49,12 @@ const invalid = [ report: { id: 'UserTask_1', message: 'Element of type must have one extension element of type ', - path: [], + path: [ + 'rootElements', + 0, + 'flowElements', + 0 + ], data: { type: ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED, node: 'UserTask_1',