Skip to content

Commit

Permalink
feat: fractional non-percentage and shorthand (#132)
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert authored Jun 28, 2024
1 parent 5025939 commit c673bf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
15 changes: 15 additions & 0 deletions flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
]
}
},
"fractional-flag-shorthand": {
"state": "ENABLED",
"variants": {
"heads": "heads",
"tails": "tails",
"draw": "draw"
},
"defaultVariant": "draw",
"targeting": {
"fractional": [
[ "heads" ],
[ "tails", 1 ]
]
}
},
"fractional-flag-A-shared-seed": {
"state": "ENABLED",
"variants": {
Expand Down
11 changes: 10 additions & 1 deletion gherkin/flagd-json-evaluator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Feature: flagd json evaluation
| "nine" | "hearts" |
| 3 | "diamonds" |

Scenario Outline: Fractional operator shorthand
When a string flag with key "fractional-flag-shorthand" is evaluated with default value "fallback"
And a context containing a targeting key with value <targeting key>
Then the returned value should be <value>
Examples:
| targeting key | value |
| "jane@company.com" | "heads" |
| "joe@company.com" | "tails" |

Scenario Outline: Fractional operator with shared seed
When a string flag with key "fractional-flag-A-shared-seed" is evaluated with default value "fallback"
And a context containing a nested property with outer key "user" and inner key "name", with value <name>
Expand All @@ -46,7 +55,7 @@ Feature: flagd json evaluation
And a context containing a nested property with outer key "user" and inner key "name", with value <name>
Then the returned value should be <value>
Examples:
| name | value |
| name | value |
| "jack" | "ace-of-hearts" |
| "queen" | "ace-of-spades" |
| "ten" | "ace-of-hearts" |
Expand Down

0 comments on commit c673bf0

Please sign in to comment.