Skip to content

Commit 6537b64

Browse files
committed
test: assert variables with different scopes not filtered by uniqueness
1 parent 6f261e1 commit 6537b64

File tree

2 files changed

+62
-13
lines changed

2 files changed

+62
-13
lines changed

test/fixtures/zeebe/simple.bpmn

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0uo7yqr" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.5.1" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
2+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0uo7yqr" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.37.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
33
<bpmn:process id="Process_1" isExecutable="true">
4-
<bpmn:startEvent id="StartEvent_1">
5-
<bpmn:outgoing>Flow_16gvdav</bpmn:outgoing>
6-
</bpmn:startEvent>
7-
<bpmn:sequenceFlow id="Flow_16gvdav" sourceRef="StartEvent_1" targetRef="ServiceTask_1" />
84
<bpmn:endEvent id="Event_0ld1d1y">
9-
<bpmn:incoming>Flow_0elge1o</bpmn:incoming>
5+
<bpmn:incoming>Flow_00zecls</bpmn:incoming>
106
</bpmn:endEvent>
11-
<bpmn:sequenceFlow id="Flow_0elge1o" sourceRef="ServiceTask_1" targetRef="Event_0ld1d1y" />
7+
<bpmn:sequenceFlow id="Flow_00zecls" sourceRef="ServiceTask_2" targetRef="Event_0ld1d1y" />
8+
<bpmn:sequenceFlow id="Flow_0elge1o" sourceRef="ServiceTask_1" targetRef="ServiceTask_2" />
9+
<bpmn:sequenceFlow id="Flow_16gvdav" sourceRef="StartEvent_1" targetRef="ServiceTask_1" />
1210
<bpmn:serviceTask id="ServiceTask_1">
1311
<bpmn:incoming>Flow_16gvdav</bpmn:incoming>
1412
<bpmn:outgoing>Flow_0elge1o</bpmn:outgoing>
1513
</bpmn:serviceTask>
14+
<bpmn:serviceTask id="ServiceTask_2">
15+
<bpmn:incoming>Flow_0elge1o</bpmn:incoming>
16+
<bpmn:outgoing>Flow_00zecls</bpmn:outgoing>
17+
</bpmn:serviceTask>
18+
<bpmn:startEvent id="StartEvent_1">
19+
<bpmn:outgoing>Flow_16gvdav</bpmn:outgoing>
20+
</bpmn:startEvent>
1621
</bpmn:process>
1722
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
1823
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
1924
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
2025
<dc:Bounds x="179" y="99" width="36" height="36" />
2126
</bpmndi:BPMNShape>
22-
<bpmndi:BPMNShape id="Event_0ld1d1y_di" bpmnElement="Event_0ld1d1y">
23-
<dc:Bounds x="432" y="99" width="36" height="36" />
24-
</bpmndi:BPMNShape>
2527
<bpmndi:BPMNShape id="Activity_10piuzo_di" bpmnElement="ServiceTask_1">
2628
<dc:Bounds x="270" y="77" width="100" height="80" />
2729
</bpmndi:BPMNShape>
30+
<bpmndi:BPMNShape id="Event_0ld1d1y_di" bpmnElement="Event_0ld1d1y">
31+
<dc:Bounds x="582" y="99" width="36" height="36" />
32+
</bpmndi:BPMNShape>
33+
<bpmndi:BPMNShape id="Activity_0otfqm7_di" bpmnElement="ServiceTask_2">
34+
<dc:Bounds x="420" y="77" width="100" height="80" />
35+
</bpmndi:BPMNShape>
2836
<bpmndi:BPMNEdge id="Flow_16gvdav_di" bpmnElement="Flow_16gvdav">
2937
<di:waypoint x="215" y="117" />
3038
<di:waypoint x="270" y="117" />
3139
</bpmndi:BPMNEdge>
3240
<bpmndi:BPMNEdge id="Flow_0elge1o_di" bpmnElement="Flow_0elge1o">
3341
<di:waypoint x="370" y="117" />
34-
<di:waypoint x="432" y="117" />
42+
<di:waypoint x="420" y="117" />
43+
</bpmndi:BPMNEdge>
44+
<bpmndi:BPMNEdge id="Flow_00zecls_di" bpmnElement="Flow_00zecls">
45+
<di:waypoint x="520" y="117" />
46+
<di:waypoint x="582" y="117" />
3547
</bpmndi:BPMNEdge>
3648
</bpmndi:BPMNPlane>
3749
</bpmndi:BPMNDiagram>

test/spec/zeebe/ZeebeVariableResolver.spec.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ describe('ZeebeVariableResolver', function() {
365365
);
366366

367367

368-
it('should merge variables of same scope', inject(async function(variableResolver, elementRegistry) {
368+
it('should merge variables of same scope and same name', inject(async function(variableResolver, elementRegistry) {
369369

370370
// given
371371
const root = elementRegistry.get('Process_1');
@@ -385,7 +385,44 @@ describe('ZeebeVariableResolver', function() {
385385
const variables = await variableResolver.getVariablesForElement(root);
386386

387387
// then
388-
expect(variables).to.variableEqual([ { name: 'foo', type: 'String', scope: 'Process_1', origin: [ 'ServiceTask_1', 'Process_1' ] } ]);
388+
expect(variables).to.variableEqual([
389+
{ name: 'foo', type: 'String', scope: 'Process_1', origin: [ 'ServiceTask_1', 'Process_1' ] }
390+
]);
391+
}));
392+
393+
394+
it('should not merge variables of different scopes and same name', inject(async function(variableResolver, elementRegistry) {
395+
396+
// given
397+
const serviceTask1 = elementRegistry.get('ServiceTask_1'),
398+
serviceTask2 = elementRegistry.get('ServiceTask_2');
399+
400+
createProvider({
401+
variables: [ { name: 'foo', type: 'String', scope: serviceTask1 } ],
402+
variableResolver,
403+
origin: 'ServiceTask_1'
404+
});
405+
createProvider({
406+
variables: [ { name: 'foo', type: 'String', scope: serviceTask2 } ],
407+
variableResolver,
408+
origin: 'ServiceTask_2'
409+
});
410+
411+
// when
412+
let variables = await variableResolver.getVariablesForElement(serviceTask1);
413+
414+
// then
415+
expect(variables).to.variableEqual([
416+
{ name: 'foo', type: 'String', scope: 'ServiceTask_1', origin: [ 'ServiceTask_1' ] },
417+
]);
418+
419+
// when
420+
variables = await variableResolver.getVariablesForElement(serviceTask2);
421+
422+
// then
423+
expect(variables).to.variableEqual([
424+
{ name: 'foo', type: 'String', scope: 'ServiceTask_2', origin: [ 'ServiceTask_2' ] },
425+
]);
389426
}));
390427

391428

0 commit comments

Comments
 (0)