Skip to content

Commit bd8eb4e

Browse files
barinalinikku
authored andcommitted
test: add failing test for unresolvable path expression
Related to #87 Path FEEL expressions like `=agent.context` on an `Any`-typed variable incorrectly resolve as `null` with `Null` type instead of `Any`.
1 parent fadfb4e commit bd8eb4e

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
3+
<bpmn:process id="Process_1" isExecutable="true">
4+
<bpmn:subProcess id="SubProcess_1" name="SubProcess_1">
5+
<bpmn:extensionElements>
6+
<zeebe:ioMapping>
7+
<zeebe:input source="=agent.context" target="agentContext" />
8+
<zeebe:output source="=agent" target="agent" />
9+
</zeebe:ioMapping>
10+
</bpmn:extensionElements>
11+
</bpmn:subProcess>
12+
</bpmn:process>
13+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
14+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
15+
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
16+
<dc:Bounds x="160" y="80" width="350" height="200" />
17+
<bpmndi:BPMNLabel />
18+
</bpmndi:BPMNShape>
19+
</bpmndi:BPMNPlane>
20+
</bpmndi:BPMNDiagram>
21+
</bpmn:definitions>

test/spec/zeebe/Mappings.spec.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import propagationXML from 'test/fixtures/zeebe/mappings/propagation.bpmn';
2424
import scriptTaskXML from 'test/fixtures/zeebe/mappings/script-task.bpmn';
2525
import scriptTaskEmptyExpressionXML from 'test/fixtures/zeebe/mappings/script-task-empty-expression.bpmn';
2626
import scriptTaskOutputNoNameXML from 'test/fixtures/zeebe/mappings/script-task-output-no-name.bpmn';
27+
import unresolvablePathExpressionXML from 'test/fixtures/zeebe/mappings/unresolvable-path-expression.bpmn';
2728

2829
import VariableProvider from 'lib/VariableProvider';
2930

@@ -474,6 +475,38 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
474475
});
475476

476477

478+
describe('Unresolvable path expression', function() {
479+
480+
beforeEach(bootstrap(unresolvablePathExpressionXML));
481+
482+
483+
it('should resolve unresolvable path expression as <Any>', inject(async function(variableResolver, elementRegistry) {
484+
485+
// given
486+
const subProcess = elementRegistry.get('SubProcess_1');
487+
488+
// when
489+
const variables = await variableResolver.getVariablesForElement(subProcess);
490+
491+
// then
492+
// cf. https://github.com/bpmn-io/variable-resolver/issues/87
493+
expect(variables).to.variableEqual([
494+
{
495+
name: 'agentContext',
496+
type: 'Any',
497+
info: '=agent.context'
498+
},
499+
{
500+
name: 'agent',
501+
type: 'Any',
502+
info: '=agent'
503+
}
504+
]);
505+
}));
506+
507+
});
508+
509+
477510
describe('Scope', function() {
478511

479512
beforeEach(bootstrap(scopeXML));

0 commit comments

Comments
 (0)