Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,56 @@
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "var": "user.name" },
{"cat": [
{ "var": "$flagd.flagKey" },
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
[ "spades", 25 ]
]
}
},
"fractional-flag-A-shared-seed": {
"state": "ENABLED",
"variants": {
"clubs": "clubs",
"diamonds": "diamonds",
"hearts": "hearts",
"spades": "spades",
"wild": "wild"
},
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "cat": [
"shared-seed",
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
[ "spades", 25 ]
]
}
},
"fractional-flag-B-shared-seed": {
"state": "ENABLED",
"variants": {
"clubs": "clubs-B",
"diamonds": "diamonds-B",
"hearts": "hearts-B",
"spades": "spades-B",
"wild": "wild-B"
},
"defaultVariant": "wild",
"targeting": {
"fractional": [
{ "cat": [
"shared-seed",
{ "var": "user.name" }
]},
[ "clubs", 25 ],
[ "diamonds", 25 ],
[ "hearts", 25 ],
Expand Down
22 changes: 22 additions & 0 deletions gherkin/flagd-json-evaluator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ Feature: flagd json evaluation
| "nine" | "hearts" |
| 3 | "wild" |

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>
Then the returned value should be <value>
Examples:
| name | value |
| "jack" | "hearts" |
| "queen" | "spades" |
| "ten" | "hearts" |
| "nine" | "diamonds" |

Scenario Outline: Second fractional operator with shared seed
When a string flag with key "fractional-flag-B-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>
Then the returned value should be <value>
Examples:
| name | value |
| "jack" | "hearts-B" |
| "queen" | "spades-B" |
| "ten" | "hearts-B" |
| "nine" | "diamonds-B" |

Scenario Outline: Substring operators
When a string flag with key "starts-ends-flag" is evaluated with default value "fallback"
And a context containing a key "id", with value <id>
Expand Down