Skip to content

Commit df8c23d

Browse files
Copilotemyller
andauthored
Add JSONPath unicode and special character test coverage (#42)
* Initial plan * Add test case for JSONPath unicode support Co-authored-by: emyller <[email protected]> * Use JSONPath expressions in property field and remove extra test cases Co-authored-by: emyller <[email protected]> * Split combined unicode and special chars into separate conditions Co-authored-by: emyller <[email protected]> * Improve special char trait name from [withdot] to [$the.size$] Co-authored-by: emyller <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: emyller <[email protected]>
1 parent 024f7bf commit df8c23d

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
// Given: A segment with multiple EQUAL conditions using JSONPath selectors containing unicode characters and special characters
3+
// When: An evaluation context with an identity that has traits matching all unicode JSONPath selectors
4+
// Then: The context should be considered part of the segment
5+
//
6+
// This test ensures that JSONPath engines correctly parse and escape trait names with:
7+
// - Unicode characters (Spanish: tamaño, Japanese: サイズ)
8+
// - Characters with special meaning to regular expressions (brackets, dots, dollar signs: [$the.size$])
9+
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
10+
"context": {
11+
"environment": {
12+
"key": "key",
13+
"name": "Environment"
14+
},
15+
"identity": {
16+
"identifier": "unicode_user",
17+
"key": "key_unicode_user",
18+
"traits": {
19+
"tamaño": "grande",
20+
"サイズ": "medium",
21+
"[$the.size$]": "small"
22+
}
23+
},
24+
"segments": {
25+
"100": {
26+
"key": "100",
27+
"name": "segment_unicode_jsonpath",
28+
"rules": [
29+
{
30+
"type": "ALL",
31+
"conditions": [
32+
{
33+
"operator": "EQUAL",
34+
"property": "$.identity.traits.tamaño",
35+
"value": "grande"
36+
},
37+
{
38+
"operator": "EQUAL",
39+
"property": "$.identity.traits.サイズ",
40+
"value": "medium"
41+
},
42+
{
43+
"operator": "EQUAL",
44+
"property": "$.identity.traits['[$the.size$]']",
45+
"value": "small"
46+
}
47+
]
48+
}
49+
]
50+
}
51+
}
52+
},
53+
"result": {
54+
"flags": {},
55+
"segments": [
56+
{
57+
"name": "segment_unicode_jsonpath"
58+
}
59+
]
60+
}
61+
}

0 commit comments

Comments
 (0)