From 8a7ecbfd549369fb17be0df0ccf72ec0919ba0b2 Mon Sep 17 00:00:00 2001 From: Valentin Serra Date: Mon, 5 Aug 2024 00:53:58 +0200 Subject: [PATCH] feat: support `zeebe:priority` Closes #62 --- resources/zeebe.json | 18 +++++++++++ .../xml/userTask-zeebe-priority.part.bpmn | 9 ++++++ test/spec/xml/read.js | 31 +++++++++++++++++++ test/spec/xml/write.js | 20 ++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 test/fixtures/xml/userTask-zeebe-priority.part.bpmn diff --git a/resources/zeebe.json b/resources/zeebe.json index 84bddae..965e16f 100644 --- a/resources/zeebe.json +++ b/resources/zeebe.json @@ -363,6 +363,24 @@ } ] }, + { + "name": "Priority", + "superClass": [ + "Element" + ], + "meta": { + "allowedIn": [ + "bpmn:UserTask" + ] + }, + "properties": [ + { + "name": "value", + "type": "String", + "isAttr": true + } + ] + }, { "name": "TaskSchedule", "superClass": [ diff --git a/test/fixtures/xml/userTask-zeebe-priority.part.bpmn b/test/fixtures/xml/userTask-zeebe-priority.part.bpmn new file mode 100644 index 0000000..7488bf3 --- /dev/null +++ b/test/fixtures/xml/userTask-zeebe-priority.part.bpmn @@ -0,0 +1,9 @@ + + + + + diff --git a/test/spec/xml/read.js b/test/spec/xml/read.js index c6ddf82..befc1be 100644 --- a/test/spec/xml/read.js +++ b/test/spec/xml/read.js @@ -707,6 +707,37 @@ describe('read', function() { }); + describe('zeebe:Priority', function() { + + it('on UserTask', async function() { + + // given + var xml = readFile('test/fixtures/xml/userTask-zeebe-priority.part.bpmn'); + + // when + const { + rootElement: task + } = await moddle.fromXML(xml, 'bpmn:UserTask'); + + // then + expect(task).to.jsonEqual({ + $type: 'bpmn:UserTask', + id: 'user-task-1', + extensionElements: { + $type: 'bpmn:ExtensionElements', + values: [ + { + $type: 'zeebe:Priority', + value: '9001' + } + ] + } + }); + }); + + }); + + describe('zeebe:TaskSchedule', function() { it('on UserTask', async function() { diff --git a/test/spec/xml/write.js b/test/spec/xml/write.js index ebaa09a..916b875 100644 --- a/test/spec/xml/write.js +++ b/test/spec/xml/write.js @@ -372,6 +372,26 @@ describe('write', function() { }); + it('zeebe:Priority', async function() { + + // given + var priority = moddle.create('zeebe:Priority', { + value: '100' + }); + + var expectedXML = ''; + + // when + const xml = await write(priority); + + // then + expect(xml).to.eql(expectedXML); + + }); + + it('zeebe:TaskSchedule', async function() { // given