Skip to content

Commit 024f7bf

Browse files
authored
feat: Add multivariate segment override test (#41)
1 parent b38c262 commit 024f7bf

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
// Given: A multivariate feature with 50% allocation in both environment and segment
3+
// and an identity key resulting in 50% allocation
4+
// When: Evaluating the feature for the given identity
5+
// Then: The variant should be selected as the feature value from the segment override
6+
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
7+
"context": {
8+
"environment": {
9+
"key": "8AYnz4q3KEfT5DFtnramnP",
10+
"name": "Production"
11+
},
12+
"identity": {
13+
"identifier": "user-123",
14+
"key": "8AYnz4q3KEfT5DFtnramnP_user-123",
15+
},
16+
"features": {
17+
"mv_feature": {
18+
"key": "1016365",
19+
"name": "mv_feature",
20+
"enabled": false,
21+
"value": "env-control-value",
22+
"variants": [
23+
{
24+
"priority": 191505,
25+
"value": "50-allocation",
26+
"weight": 50
27+
}
28+
]
29+
}
30+
},
31+
"segments": {
32+
"713564": {
33+
"key": "713564",
34+
"name": "user-123",
35+
"rules": [
36+
{
37+
"type": "ALL",
38+
"conditions": [],
39+
"rules": [
40+
{
41+
"type": "ANY",
42+
"conditions": [
43+
{
44+
"property": "$.environment.name",
45+
"operator": "EQUAL",
46+
"value": "Production"
47+
}
48+
],
49+
"rules": []
50+
}
51+
]
52+
}
53+
],
54+
"overrides": [
55+
{
56+
"key": "1016366",
57+
"name": "mv_feature",
58+
"enabled": true,
59+
"value": "segment-control-value",
60+
"variants": [
61+
{
62+
"priority": 191506,
63+
"value": "50-allocation",
64+
"weight": 50
65+
}
66+
],
67+
"priority": 0
68+
}
69+
]
70+
}
71+
}
72+
},
73+
"result": {
74+
"flags": {
75+
"mv_feature": {
76+
"name": "mv_feature",
77+
"enabled": true,
78+
"value": "50-allocation",
79+
"reason": "SPLIT; weight=50"
80+
}
81+
},
82+
"segments": [
83+
{
84+
"name": "user-123"
85+
}
86+
]
87+
}
88+
}

0 commit comments

Comments
 (0)