diff --git a/evaluator/flags/testkit-flags.json b/evaluator/flags/testkit-flags.json index 268e905..43df0d4 100644 --- a/evaluator/flags/testkit-flags.json +++ b/evaluator/flags/testkit-flags.json @@ -447,6 +447,19 @@ ] } }, + "fractional-single-entry-flag": { + "state": "ENABLED", + "variants": { + "single": "single", + "fallback": "fallback" + }, + "defaultVariant": "fallback", + "targeting": { + "fractional": [ + [ "single", 1 ] + ] + } + }, "semver-invalid-version-flag": { "state": "ENABLED", "variants": { "match": "match", "no-match": "no-match", "fallback": "fallback" }, diff --git a/evaluator/gherkin/fractional.feature b/evaluator/gherkin/fractional.feature index f6a363b..3c55930 100644 --- a/evaluator/gherkin/fractional.feature +++ b/evaluator/gherkin/fractional.feature @@ -72,6 +72,12 @@ Feature: Evaluator fractional operator | nine | clubs | | two | spades | + @fractional-v2 + Scenario: Fractional operator with single entry always resolves to the only variant + Given a String-flag with key "fractional-single-entry-flag" and a fallback value "fallback" + When the flag was evaluated with details + Then the resolved details value should be "single" + Scenario Outline: Second fractional operator with shared seed Given a String-flag with key "fractional-flag-B-shared-seed" and a fallback value "fallback" And a context containing a nested property with outer key "user" and inner key "name", with value "" diff --git a/flags/custom-ops.json b/flags/custom-ops.json index 85f5f9a..4749109 100644 --- a/flags/custom-ops.json +++ b/flags/custom-ops.json @@ -23,6 +23,19 @@ ] } }, + "fractional-single-entry-flag": { + "state": "ENABLED", + "variants": { + "single": "single", + "fallback": "fallback" + }, + "defaultVariant": "fallback", + "targeting": { + "fractional": [ + [ "single", 1 ] + ] + } + }, "fractional-flag-shorthand": { "state": "ENABLED", "variants": { diff --git a/gherkin/targeting.feature b/gherkin/targeting.feature index 5dd7ae2..966b8d5 100644 --- a/gherkin/targeting.feature +++ b/gherkin/targeting.feature @@ -67,6 +67,12 @@ Feature: Targeting rules | jon@company.com | heads | | jane@company.com | tails | + @fractional @fractional-v2 + Scenario: Fractional operator with single entry always resolves to the only variant + Given a String-flag with key "fractional-single-entry-flag" and a default value "fallback" + When the flag was evaluated with details + Then the resolved details value should be "single" + @fractional Scenario Outline: Fractional operator with shared seed Given a String-flag with key "fractional-flag-A-shared-seed" and a default value "fallback"