From ca1d46c9f569408d670a5ce4d349a13df5656b46 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Fri, 15 Dec 2023 15:30:51 -0500 Subject: [PATCH] feat: add empty context test (#88) Signed-off-by: Michael Beemer --- flags/edge-case-flags.json | 9 +++++++++ gherkin/flagd-json-evaluator.feature | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/flags/edge-case-flags.json b/flags/edge-case-flags.json index 771e750..aa16cb0 100644 --- a/flags/edge-case-flags.json +++ b/flags/edge-case-flags.json @@ -43,6 +43,15 @@ "targeting": { "if": [true, true, false] } + }, + "empty-targeting-flag": { + "state": "ENABLED", + "variants": { + "false": 1, + "true": 2 + }, + "defaultVariant": "false", + "targeting": {} } } } diff --git a/gherkin/flagd-json-evaluator.feature b/gherkin/flagd-json-evaluator.feature index 01e1c65..6e737ce 100644 --- a/gherkin/flagd-json-evaluator.feature +++ b/gherkin/flagd-json-evaluator.feature @@ -2,7 +2,7 @@ Feature: flagd json evaluation # This test suite contains scenarios to test the json-evaluation of flagd and flag-in-process providers. # It's associated with the flags configured in flags/changing-flag.json, flags/zero-flags.json, flags/custom-ops.json and evaluator-refs.json. - # It should be used in conjunection with the suites supplied by the OpenFeature specification. + # It should be used in conjunction with the suites supplied by the OpenFeature specification. Background: Given a flagd provider is set @@ -42,7 +42,7 @@ Feature: flagd json evaluation | "lmnopq" | "none" | | 3 | "none" | - Scenario Outline: Semantic version operator numeric comparision + Scenario Outline: Semantic version operator numeric comparison When a string flag with key "equal-greater-lesser-version-flag" is evaluated with default value "fallback" And a context containing a key "version", with value Then the returned value should be @@ -54,7 +54,7 @@ Feature: flagd json evaluation | "2.0.0-alpha" | "lesser" | | "2.0.0.0" | "none" | - Scenario Outline: Semantic version operator semantic comparision + Scenario Outline: Semantic version operator semantic comparison When a string flag with key "major-minor-version-flag" is evaluated with default value "fallback" And a context containing a key "version", with value Then the returned value should be @@ -82,3 +82,4 @@ Feature: flagd json evaluation | "error-targeting-flag" | 3 | | "missing-variant-targeting-flag" | 3 | | "non-string-variant-targeting-flag" | 2 | + | "empty-targeting-flag" | 1 |