-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gherkin tests to verify evaluation details in finally hooks (#290)
Signed-off-by: christian.lutnik <[email protected]>
- Loading branch information
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@hooks | ||
Feature: Evaluation details through hooks | ||
|
||
# This test suite contains scenarios to test the functionality of hooks. | ||
|
||
Background: | ||
Given a stable provider | ||
|
||
Scenario: Passes evaluation details to after and finally hooks | ||
Given a client with added hook | ||
And a boolean-flag with key "boolean-flag" and a default value "false" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "after, finally" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | boolean-flag | | ||
| boolean | value | true | | ||
| string | variant | on | | ||
| string | reason | STATIC | | ||
| string | error_code | null | | ||
|
||
# errors | ||
Scenario: Flag not found | ||
Given a client with added hook | ||
And a string-flag with key "missing-flag" and a default value "uh-oh" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "error" hook should have been executed | ||
And the "finally" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | missing-flag | | ||
| string | value | uh-oh | | ||
| string | variant | null | | ||
| string | reason | ERROR | | ||
| string | error_code | FLAG_NOT_FOUND | | ||
|
||
Scenario: Type error | ||
Given a client with added hook | ||
And a string-flag with key "wrong-flag" and a default value "13" | ||
When the flag was evaluated with details | ||
Then the "before" hook should have been executed | ||
And the "error" hook should have been executed | ||
And the "finally" hooks should be called with evaluation details | ||
| data_type | key | value | | ||
| string | flag_key | wrong-flag | | ||
| integer | value | 13 | | ||
| string | variant | null | | ||
| string | reason | ERROR | | ||
| string | error_code | TYPE_MISMATCH | |