Skip to content

Commit fdfac67

Browse files
authored
feat: add fractional as condition flag (#354)
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent dc43f1c commit fdfac67

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

flags/custom-ops.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,26 @@
166166
]
167167
}
168168
},
169+
"fractional-as-condition-flag": {
170+
"state": "ENABLED",
171+
"variants": {
172+
"big": "hundreds",
173+
"small": "ones",
174+
"fallback": "zero"
175+
},
176+
"defaultVariant": "fallback",
177+
"targeting": {
178+
"if": [
179+
{
180+
"fractional": [
181+
[ false, 0 ],
182+
[ true, 100 ]
183+
]
184+
},
185+
"big", "small"
186+
]
187+
}
188+
},
169189
"starts-ends-flag": {
170190
"state": "ENABLED",
171191
"variants": {

gherkin/targeting.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ Feature: Targeting rules
186186
| user1 | premium | red |
187187
| user1 | basic | blue |
188188

189+
@fractional @fractional-nested
190+
Scenario: Fractional as condition
191+
Given a String-flag with key "fractional-as-condition-flag" and a default value "zero"
192+
And a context containing a targeting key with value "some-targeting-key"
193+
When the flag was evaluated with details
194+
Then the resolved details value should be "hundreds"
195+
189196
@string
190197
Scenario Outline: Substring operators
191198
Given a String-flag with key "starts-ends-flag" and a default value "fallback"

0 commit comments

Comments
 (0)