Skip to content

Commit

Permalink
feat: add empty context test (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Beemer <[email protected]>
  • Loading branch information
beeme1mr committed Dec 15, 2023
1 parent 0710b7a commit ca1d46c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions flags/edge-case-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
"targeting": {
"if": [true, true, false]
}
},
"empty-targeting-flag": {
"state": "ENABLED",
"variants": {
"false": 1,
"true": 2
},
"defaultVariant": "false",
"targeting": {}
}
}
}
7 changes: 4 additions & 3 deletions gherkin/flagd-json-evaluator.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <version>
Then the returned value should be <value>
Expand All @@ -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 <version>
Then the returned value should be <value>
Expand Down Expand Up @@ -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 |

0 comments on commit ca1d46c

Please sign in to comment.