Skip to content

Commit 3a8c92a

Browse files
yT0n1barmac
authored andcommitted
test: add zeebe:assignmentDefinition test
1 parent a434449 commit 3a8c92a

File tree

3 files changed

+150
-1
lines changed

3 files changed

+150
-1
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[
2+
{
3+
"name": "AssignmentDefinition",
4+
"id": "com.camunda.example.AssignmentDefinition",
5+
"appliesTo": [
6+
"bpmn:Task"
7+
],
8+
"elementType": {
9+
"value": "bpmn:UserTask"
10+
},
11+
"properties": [
12+
{
13+
"type": "Hidden",
14+
"binding": {
15+
"type": "zeebe:userTask"
16+
}
17+
},
18+
{
19+
"label": "Assignee",
20+
"type": "Number",
21+
"binding": {
22+
"type": "zeebe:assignmentDefinition",
23+
"property": "assignee"
24+
}
25+
},
26+
{
27+
"label": "Assignee",
28+
"type": "Boolean",
29+
"binding": {
30+
"type": "zeebe:assignmentDefinition",
31+
"property": "assignee"
32+
}
33+
},
34+
{
35+
"type": "Number",
36+
"binding": {
37+
"type": "zeebe:assignmentDefinition",
38+
"property": "candidateUsers"
39+
}
40+
},
41+
{
42+
"type": "Boolean",
43+
"binding": {
44+
"type": "zeebe:assignmentDefinition",
45+
"property": "candidateUsers"
46+
}
47+
},
48+
{
49+
"type": "Number",
50+
"value": "someDefaultGroup",
51+
"binding": {
52+
"type": "zeebe:assignmentDefinition",
53+
"property": "candidateGroups"
54+
}
55+
},
56+
{
57+
"type": "Number",
58+
"value": "someDefaultGroup",
59+
"binding": {
60+
"type": "zeebe:assignmentDefinition",
61+
"property": "candidateGroups"
62+
}
63+
}
64+
]
65+
}
66+
]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"name": "AssignmentDefinition",
4+
"id": "com.camunda.example.AssignmentDefinition",
5+
"appliesTo": [
6+
"bpmn:Task"
7+
],
8+
"elementType": {
9+
"value": "bpmn:UserTask"
10+
},
11+
"properties": [
12+
{
13+
"type": "Hidden",
14+
"binding": {
15+
"type": "zeebe:userTask"
16+
}
17+
},
18+
{
19+
"label": "Assignee",
20+
"description": "Assignee for user task",
21+
"type": "String",
22+
"binding": {
23+
"type": "zeebe:assignmentDefinition",
24+
"property": "assignee"
25+
}
26+
},
27+
{
28+
"type": "Text",
29+
"binding": {
30+
"type": "zeebe:assignmentDefinition",
31+
"property": "candidateUsers"
32+
}
33+
},
34+
{
35+
"type": "Hidden",
36+
"value": "someDefaultGroup",
37+
"binding": {
38+
"type": "zeebe:assignmentDefinition",
39+
"property": "candidateGroups"
40+
}
41+
}
42+
]
43+
}
44+
]

test/spec/validationSpec.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe('Validator', function() {
334334
message: 'must provide choices=[] with "Dropdown" type'
335335
},
336336
{
337-
message: 'invalid property.binding type "zeebe:taskDefinition:foo"; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:property, zeebe:taskHeader, bpmn:Message#property, bpmn:Message#zeebe:subscription#property, zeebe:taskDefinition, zeebe:calledElement, zeebe:linkedResource, zeebe:userTask, zeebe:formDefinition, zeebe:calledDecision, zeebe:script }'
337+
message: 'invalid property.binding type "zeebe:taskDefinition:foo"; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:property, zeebe:taskHeader, bpmn:Message#property, bpmn:Message#zeebe:subscription#property, zeebe:taskDefinition, zeebe:calledElement, zeebe:linkedResource, zeebe:userTask, zeebe:formDefinition, zeebe:calledDecision, zeebe:script, zeebe:assignmentDefinition }'
338338
},
339339
{
340340
message: 'property.binding "zeebe:taskHeader" requires key'
@@ -854,6 +854,45 @@ describe('Validator', function() {
854854
});
855855

856856

857+
it('should validate assignmentDefinition templates', function() {
858+
859+
// given
860+
const samples = require('../fixtures/assignment-definition.json');
861+
862+
// when
863+
const {
864+
valid,
865+
results
866+
} = validateAllZeebe(samples);
867+
868+
// then
869+
expect(valid).to.be.true;
870+
expect(results.length).to.eql(samples.length);
871+
872+
expect(results.every(r => r.valid)).to.be.true;
873+
874+
expect(results.map(r => r.object)).to.eql(samples);
875+
});
876+
877+
878+
it('should validate assignmentDefinition templates with errors', function() {
879+
880+
// given
881+
const samples = require('../fixtures/assignment-definition-broken.json');
882+
883+
// when
884+
const {
885+
valid,
886+
results
887+
} = validateAllZeebe(samples);
888+
889+
// then
890+
expect(valid).to.be.false;
891+
expect(results.every(r => !r.valid)).to.be.true;
892+
expect(results.map(r => r.object)).to.eql(samples);
893+
});
894+
895+
857896
describe('property', function() {
858897

859898
it('should validate', function() {

0 commit comments

Comments
 (0)