Skip to content

Commit 10c43a7

Browse files
yT0n1philippfromme
authored andcommitted
test: add zeebe:taskSchedule tests
related to camunda/camunda-modeler#5093
1 parent 424dfe2 commit 10c43a7

File tree

4 files changed

+173
-0
lines changed

4 files changed

+173
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to [element-templates-validator](https://github.com/bpmn-io/
66

77
___Note:__ Yet to be released changes appear here._
88

9+
* `FEAT`: support `zeebe:taskSchedule` binding
10+
911
## 2.11.0
1012

1113
* `FEAT`: support `zeebe:adHoc` binding ([#67](https://github.com/bpmn-io/element-templates-validator/pull/67))
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[
2+
{
3+
"name": "task schedule",
4+
"id": "task-schedule-1",
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+
"type": "String",
20+
"value": "tomorrow",
21+
"binding": {
22+
"type": "zeebe:taskSchedule",
23+
"property": "dueDate"
24+
}
25+
},
26+
{
27+
"type": "String",
28+
"value": "2020/10/01T12:00:00Z",
29+
"binding": {
30+
"type": "zeebe:taskSchedule",
31+
"property": "followUpDate"
32+
}
33+
}
34+
]
35+
}
36+
]

test/fixtures/task-schedule.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
[
2+
{
3+
"name": "task schedule",
4+
"id": "task-schedule-1",
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+
"type": "Hidden",
20+
"value": "2019-10-01T12:00:00Z",
21+
"binding": {
22+
"type": "zeebe:taskSchedule",
23+
"property": "dueDate"
24+
}
25+
},
26+
{
27+
"type": "Hidden",
28+
"value": "2019-10-02T08:09:40+02:00",
29+
"binding": {
30+
"type": "zeebe:taskSchedule",
31+
"property": "followUpDate"
32+
}
33+
}
34+
]
35+
},
36+
{
37+
"name": "task schedule",
38+
"id": "task-schedule-2",
39+
"appliesTo": [
40+
"bpmn:Task"
41+
],
42+
"elementType": {
43+
"value": "bpmn:UserTask"
44+
},
45+
"properties": [
46+
{
47+
"type": "Hidden",
48+
"binding": {
49+
"type": "zeebe:userTask"
50+
}
51+
},
52+
{
53+
"type": "Hidden",
54+
"value": "2019-10-02T08:09:40+02:00[Europe/Berlin]",
55+
"binding": {
56+
"type": "zeebe:taskSchedule",
57+
"property": "followUpDate"
58+
}
59+
}
60+
]
61+
},
62+
{
63+
"name": "task schedule",
64+
"id": "task-schedule-3",
65+
"appliesTo": [
66+
"bpmn:Task"
67+
],
68+
"elementType": {
69+
"value": "bpmn:UserTask"
70+
},
71+
"properties": [
72+
{
73+
"type": "Hidden",
74+
"binding": {
75+
"type": "zeebe:userTask"
76+
}
77+
},
78+
{
79+
"type": "Hidden",
80+
"value": "2019-10-01T12:00:00Z",
81+
"binding": {
82+
"type": "zeebe:taskSchedule",
83+
"property": "dueDate"
84+
}
85+
},
86+
{
87+
"type": "String",
88+
"value": "2035-08-11T14:30:00-03:30",
89+
"description": "Valid negative timezone offset with half-hour increment",
90+
"binding": {
91+
"type": "zeebe:taskSchedule",
92+
"property": "followUpDate"
93+
}
94+
}
95+
]
96+
}
97+
]

test/spec/validationSpec.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,44 @@ describe('Validator', function() {
970970
expect(results.map(r => r.object)).to.eql(samples);
971971
});
972972

973+
it('should validate taskSchedule templates', function() {
974+
975+
// given
976+
const samples = require('../fixtures/task-schedule.json');
977+
978+
// when
979+
const {
980+
valid,
981+
results
982+
} = validateAllZeebe(samples);
983+
984+
// then
985+
expect(valid).to.be.true;
986+
expect(results.length).to.eql(samples.length);
987+
988+
expect(results.every(r => r.valid)).to.be.true;
989+
990+
expect(results.map(r => r.object)).to.eql(samples);
991+
});
992+
993+
994+
it('should validate taskSchedule templates with errors', function() {
995+
996+
// given
997+
const samples = require('../fixtures/task-schedule-broken.json');
998+
999+
// when
1000+
const {
1001+
valid,
1002+
results
1003+
} = validateAllZeebe(samples);
1004+
1005+
// then
1006+
expect(valid).to.be.false;
1007+
expect(results.every(r => !r.valid)).to.be.true;
1008+
expect(results.map(r => r.object)).to.eql(samples);
1009+
});
1010+
9731011

9741012
describe('property', function() {
9751013

0 commit comments

Comments
 (0)