Skip to content

Commit 6b38158

Browse files
authored
feat: Add IN tests for boolean context values (#32)
1 parent 41c2021 commit 6b38158

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
// Given: A segment with IN condition using comma-separated string values, including string representations of boolean false
3+
// When: An evaluation context with an identity that has a boolean false trait value
4+
// Then: The context should not be considered part of the segment since boolean false doesn't match string values
5+
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
6+
"context": {
7+
"environment": {
8+
"key": "key",
9+
"name": "Environment"
10+
},
11+
"identity": {
12+
"identifier": "none_trait_user",
13+
"key": "key_none_trait_user",
14+
"traits": {
15+
"status": false
16+
}
17+
},
18+
"segments": {
19+
"24": {
20+
"key": "24",
21+
"name": "segment_string_values_with_boolean_trait",
22+
"rules": [
23+
{
24+
"type": "ALL",
25+
"conditions": [
26+
{
27+
"operator": "IN",
28+
"property": "status",
29+
"value": "foo,false,False,0,null,bar"
30+
}
31+
]
32+
}
33+
]
34+
}
35+
}
36+
},
37+
"result": {
38+
"flags": {},
39+
"segments": []
40+
}
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
// Given: A segment with IN condition using comma-separated string values, including string representations of boolean true
3+
// When: An evaluation context with an identity that has a boolean true trait value
4+
// Then: The context should not be considered part of the segment since boolean true doesn't match string values
5+
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
6+
"context": {
7+
"environment": {
8+
"key": "key",
9+
"name": "Environment"
10+
},
11+
"identity": {
12+
"identifier": "none_trait_user",
13+
"key": "key_none_trait_user",
14+
"traits": {
15+
"status": true
16+
}
17+
},
18+
"segments": {
19+
"24": {
20+
"key": "24",
21+
"name": "segment_string_values_with_boolean_trait",
22+
"rules": [
23+
{
24+
"type": "ALL",
25+
"conditions": [
26+
{
27+
"operator": "IN",
28+
"property": "status",
29+
"value": "foo,true,True,1,bar"
30+
}
31+
]
32+
}
33+
]
34+
}
35+
}
36+
},
37+
"result": {
38+
"flags": {},
39+
"segments": []
40+
}
41+
}

0 commit comments

Comments
 (0)