Skip to content

Commit 9a6296a

Browse files
committed
prepare integration tests for global-state to define it as an object separate from expression parameters
1 parent ffc6ee0 commit 9a6296a

File tree

14 files changed

+432
-20
lines changed

14 files changed

+432
-20
lines changed

test/integration/expression/tests/global-state/basic/test.json

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,11 @@
1010
[
1111
{},
1212
{}
13-
],
14-
[
15-
{
16-
"globalState": {}
17-
},
18-
{}
19-
],
20-
[
21-
{
22-
"globalState": {
23-
"x": 1
24-
}
25-
},
26-
{}
2713
]
2814
],
15+
"globalState": {
16+
"x": 1
17+
},
2918
"expected": {
3019
"compiled": {
3120
"result": "success",
@@ -34,12 +23,6 @@
3423
"type": "number"
3524
},
3625
"outputs": [
37-
{
38-
"error": "Expected value to be of type number, but found null instead."
39-
},
40-
{
41-
"error": "Expected value to be of type number, but found null instead."
42-
},
4326
1
4427
]
4528
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"number",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {},
16+
"expected": {
17+
"compiled": {
18+
"result": "success",
19+
"isFeatureConstant": true,
20+
"isZoomConstant": true,
21+
"type": "number"
22+
},
23+
"outputs": [
24+
{
25+
"error": "Expected value to be of type number, but found null instead."
26+
}
27+
]
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {
16+
"x": ""
17+
},
18+
"expected": {
19+
"compiled": {
20+
"result": "success",
21+
"isFeatureConstant": true,
22+
"isZoomConstant": true,
23+
"type": "boolean"
24+
},
25+
"outputs": [
26+
false
27+
]
28+
}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {},
16+
"expected": {
17+
"compiled": {
18+
"result": "success",
19+
"isFeatureConstant": true,
20+
"isZoomConstant": true,
21+
"type": "boolean"
22+
},
23+
"outputs": [
24+
false
25+
]
26+
}
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {
16+
"x": false
17+
},
18+
"expected": {
19+
"compiled": {
20+
"result": "success",
21+
"isFeatureConstant": true,
22+
"isZoomConstant": true,
23+
"type": "boolean"
24+
},
25+
"outputs": [
26+
false
27+
]
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {
16+
"x": null
17+
},
18+
"expected": {
19+
"compiled": {
20+
"result": "success",
21+
"isFeatureConstant": true,
22+
"isZoomConstant": true,
23+
"type": "boolean"
24+
},
25+
"outputs": [
26+
false
27+
]
28+
}
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"expected": {
16+
"compiled": {
17+
"result": "success",
18+
"isFeatureConstant": true,
19+
"isZoomConstant": true,
20+
"type": "boolean"
21+
},
22+
"outputs": [
23+
false
24+
]
25+
}
26+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {
16+
"x": 0
17+
},
18+
"expected": {
19+
"compiled": {
20+
"result": "success",
21+
"isFeatureConstant": true,
22+
"isZoomConstant": true,
23+
"type": "boolean"
24+
},
25+
"outputs": [
26+
false
27+
]
28+
}
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"expression": [
3+
"number",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"expected": {
16+
"compiled": {
17+
"result": "success",
18+
"isFeatureConstant": true,
19+
"isZoomConstant": true,
20+
"type": "number"
21+
},
22+
"outputs": [
23+
{
24+
"error": "Expected value to be of type number, but found null instead."
25+
}
26+
]
27+
}
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"expression": [
3+
"to-boolean",
4+
[
5+
"global-state",
6+
"x"
7+
]
8+
],
9+
"inputs": [
10+
[
11+
{},
12+
{}
13+
]
14+
],
15+
"globalState": {
16+
"x": 5
17+
},
18+
"expected": {
19+
"compiled": {
20+
"result": "success",
21+
"isFeatureConstant": true,
22+
"isZoomConstant": true,
23+
"type": "boolean"
24+
},
25+
"outputs": [
26+
true
27+
]
28+
}
29+
}

0 commit comments

Comments
 (0)