diff --git a/test_cases/test_contains_integer__should_not_match.jsonc b/test_cases/test_contains_integer__should_not_match.jsonc new file mode 100644 index 0000000..10a2f90 --- /dev/null +++ b/test_cases/test_contains_integer__should_not_match.jsonc @@ -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": [] + } +} diff --git a/test_cases/test_greater_than_float__integer_condition__should_match.jsonc b/test_cases/test_greater_than_float__integer_condition__should_match.jsonc new file mode 100644 index 0000000..f88173f --- /dev/null +++ b/test_cases/test_greater_than_float__integer_condition__should_match.jsonc @@ -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" + } + ] + } +} diff --git a/test_cases/test_greater_than_integer__decimal_condition__should_not_match.jsonc b/test_cases/test_greater_than_integer__decimal_condition__should_not_match.jsonc new file mode 100644 index 0000000..033ff70 --- /dev/null +++ b/test_cases/test_greater_than_integer__decimal_condition__should_not_match.jsonc @@ -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": [] + } +} diff --git a/test_cases/test_not_equal_integer__decimal_condition__should_not_match.jsonc b/test_cases/test_not_equal_integer__decimal_condition__should_not_match.jsonc new file mode 100644 index 0000000..2ad8441 --- /dev/null +++ b/test_cases/test_not_equal_integer__decimal_condition__should_not_match.jsonc @@ -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": [] + } +}