Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
// Given: A segment with a top-level ANY rule containing ALL sub-rule groups
// When: Identity traits match neither group (wrong user_id for Production)
// Then: The segment should not match
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Production"
},
"identity": {
"identifier": "user_2",
"key": "key_user_2",
"traits": {
"user_id": "999"
}
},
"segments": {
"100": {
"key": "100",
"name": "user_per_env",
"rules": [
{
"type": "ANY",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "EQUAL",
"property": "$.environment.name",
"value": "Production"
},
{
"operator": "EQUAL",
"property": "user_id",
"value": "123"
}
]
},
{
"type": "ALL",
"conditions": [
{
"operator": "EQUAL",
"property": "$.environment.name",
"value": "QA"
},
{
"operator": "EQUAL",
"property": "user_id",
"value": "456"
}
]
}
]
}
],
"overrides": [
{
"enabled": true,
"key": "1",
"name": "test_feature",
"value": "overridden"
}
]
}
},
"features": {
"test_feature": {
"enabled": false,
"key": "1",
"name": "test_feature",
"value": "default"
}
}
},
"result": {
"flags": {
"test_feature": {
"enabled": false,
"name": "test_feature",
"value": "default",
"reason": "DEFAULT"
}
},
"segments": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
// Given: A segment with a top-level ANY rule containing ALL sub-rule groups
// When: Identity traits match one group (Production + user 123) but not the other
// Then: The segment should match (ANY = OR between groups)
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Production"
},
"identity": {
"identifier": "user_1",
"key": "key_user_1",
"traits": {
"user_id": "123"
}
},
"segments": {
"100": {
"key": "100",
"name": "user_per_env",
"rules": [
{
"type": "ANY",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "EQUAL",
"property": "$.environment.name",
"value": "Production"
},
{
"operator": "EQUAL",
"property": "user_id",
"value": "123"
}
]
},
{
"type": "ALL",
"conditions": [
{
"operator": "EQUAL",
"property": "$.environment.name",
"value": "QA"
},
{
"operator": "EQUAL",
"property": "user_id",
"value": "456"
}
]
}
]
}
],
"overrides": [
{
"enabled": true,
"key": "1",
"name": "test_feature",
"value": "overridden"
}
]
}
},
"features": {
"test_feature": {
"enabled": false,
"key": "1",
"name": "test_feature",
"value": "default"
}
}
},
"result": {
"flags": {
"test_feature": {
"enabled": true,
"name": "test_feature",
"value": "overridden",
"reason": "TARGETING_MATCH; segment=user_per_env"
}
},
"segments": [
{
"name": "user_per_env"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
// Given: A segment with a top-level NONE rule containing an ALL sub-rule group
// When: Identity traits match the ALL group (is_bot = true AND tier = free)
// Then: The segment should not match (NONE excludes matching groups)
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Production"
},
"identity": {
"identifier": "bot_user",
"key": "key_bot_user",
"traits": {
"is_bot": "true",
"tier": "free"
}
},
"segments": {
"200": {
"key": "200",
"name": "exclude_bots",
"rules": [
{
"type": "NONE",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "EQUAL",
"property": "is_bot",
"value": "true"
},
{
"operator": "EQUAL",
"property": "tier",
"value": "free"
}
]
}
]
}
],
"overrides": [
{
"enabled": true,
"key": "1",
"name": "test_feature",
"value": "overridden"
}
]
}
},
"features": {
"test_feature": {
"enabled": false,
"key": "1",
"name": "test_feature",
"value": "default"
}
}
},
"result": {
"flags": {
"test_feature": {
"enabled": false,
"name": "test_feature",
"value": "default",
"reason": "DEFAULT"
}
},
"segments": []
}
}