Skip to content
Merged
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
41 changes: 41 additions & 0 deletions test_cases/test_contains_integer__should_not_match.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Given: A segment with a CONTAINS condition checking if score contains "9"
// When: An evaluation context with an identity that has score 95 (integer, not a string)
// Then: The context should not be considered part of the segment
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Environment"
},
"identity": {
"identifier": "high_scorer",
"key": "key_high_scorer",
"traits": {
"score": 95
}
},
"segments": {
"1": {
"key": "1",
"name": "nine_scorers_segment",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "CONTAINS",
"property": "score",
"value": "9"
}
]
}
]
}
}
},
"result": {
"flags": {},
"segments": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
// Given: A segment with a GREATER_THAN condition checking if score > "90"
// When: An evaluation context with an identity that has score 95.5 (float, greater than threshold)
// Then: The context should be considered part of the segment
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Environment"
},
"identity": {
"identifier": "high_scorer",
"key": "key_high_scorer",
"traits": {
"score": 95.5
}
},
"segments": {
"1": {
"key": "1",
"name": "high_scorers_segment",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "GREATER_THAN",
"property": "score",
"value": "90"
}
]
}
]
}
}
},
"result": {
"flags": {},
"segments": [
{
"name": "high_scorers_segment"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Given: A segment with a GREATER_THAN condition checking if score > "90.5"
// When: An evaluation context with an identity that has score 95 (integer, condition value cannot be coerced to an integer)
// Then: The context should not be considered part of the segment due to failed coercion
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Environment"
},
"identity": {
"identifier": "high_scorer",
"key": "key_high_scorer",
"traits": {
"score": 95
}
},
"segments": {
"1": {
"key": "1",
"name": "high_scorers_segment",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "GREATER_THAN",
"property": "score",
"value": "90.5"
}
]
}
]
}
}
},
"result": {
"flags": {},
"segments": []
}
}
Comment thread
emyller marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Given: A segment with a NOT_EQUAL condition checking if score != "90.5"
// When: An evaluation context with an identity that has score 95 (integer, condition value cannot be coerced to an integer)
// Then: The context should not be considered part of the segment due to failed coercion
"$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json",
"context": {
"environment": {
"key": "key",
"name": "Environment"
},
"identity": {
"identifier": "high_scorer",
"key": "key_high_scorer",
"traits": {
"score": 95
}
},
"segments": {
"1": {
"key": "1",
"name": "non_threshold_scorers_segment",
"rules": [
{
"type": "ALL",
"conditions": [
{
"operator": "NOT_EQUAL",
"property": "score",
"value": "90.5"
}
]
}
]
}
}
},
"result": {
"flags": {},
"segments": []
}
}