From 8863b34ffb52fd2f469f01e1596e91d9d1c12dc0 Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Wed, 22 Oct 2025 12:56:00 +0100 Subject: [PATCH] feat: Add `IN` tests for boolean context values --- ...oolean_false_trait__should_not_match.jsonc | 41 +++++++++++++++++++ ...boolean_true_trait__should_not_match.jsonc | 41 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 test_cases/test_in_condition_boolean_false_trait__should_not_match.jsonc create mode 100644 test_cases/test_in_condition_boolean_true_trait__should_not_match.jsonc diff --git a/test_cases/test_in_condition_boolean_false_trait__should_not_match.jsonc b/test_cases/test_in_condition_boolean_false_trait__should_not_match.jsonc new file mode 100644 index 0000000..ebdf090 --- /dev/null +++ b/test_cases/test_in_condition_boolean_false_trait__should_not_match.jsonc @@ -0,0 +1,41 @@ +{ + // Given: A segment with IN condition using comma-separated string values, including string representations of boolean false + // When: An evaluation context with an identity that has a boolean false trait value + // Then: The context should not be considered part of the segment since boolean false doesn't match string values + "$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json", + "context": { + "environment": { + "key": "key", + "name": "Environment" + }, + "identity": { + "identifier": "none_trait_user", + "key": "key_none_trait_user", + "traits": { + "status": false + } + }, + "segments": { + "24": { + "key": "24", + "name": "segment_string_values_with_boolean_trait", + "rules": [ + { + "type": "ALL", + "conditions": [ + { + "operator": "IN", + "property": "status", + "value": "foo,false,False,0,null,bar" + } + ] + } + ] + } + } + }, + "result": { + "flags": {}, + "segments": [] + } +} \ No newline at end of file diff --git a/test_cases/test_in_condition_boolean_true_trait__should_not_match.jsonc b/test_cases/test_in_condition_boolean_true_trait__should_not_match.jsonc new file mode 100644 index 0000000..4e632f5 --- /dev/null +++ b/test_cases/test_in_condition_boolean_true_trait__should_not_match.jsonc @@ -0,0 +1,41 @@ +{ + // Given: A segment with IN condition using comma-separated string values, including string representations of boolean true + // When: An evaluation context with an identity that has a boolean true trait value + // Then: The context should not be considered part of the segment since boolean true doesn't match string values + "$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json", + "context": { + "environment": { + "key": "key", + "name": "Environment" + }, + "identity": { + "identifier": "none_trait_user", + "key": "key_none_trait_user", + "traits": { + "status": true + } + }, + "segments": { + "24": { + "key": "24", + "name": "segment_string_values_with_boolean_trait", + "rules": [ + { + "type": "ALL", + "conditions": [ + { + "operator": "IN", + "property": "status", + "value": "foo,true,True,1,bar" + } + ] + } + ] + } + } + }, + "result": { + "flags": {}, + "segments": [] + } +} \ No newline at end of file