-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to provide custom seed and target key in single argument
Signed-off-by: Cole Bailey <[email protected]>
- Loading branch information
1 parent
ce8faab
commit 9f687dc
Showing
4 changed files
with
9 additions
and
67 deletions.
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 |
---|---|---|
|
@@ -29,8 +29,7 @@ func TestFractionalEvaluation(t *testing.T) { | |
}, | ||
{ | ||
"fractional": [ | ||
{"var": "email"}, | ||
{"var": "$flagd.flagKey"}, | ||
{"cat": [{"var": "$flagd.flagKey"}, {"var": "email"}]}, | ||
[ | ||
"red", | ||
25 | ||
|
@@ -70,8 +69,7 @@ func TestFractionalEvaluation(t *testing.T) { | |
}, | ||
{ | ||
"fractional": [ | ||
{"var": "email"}, | ||
"my-seed", | ||
{"cat": ["my-seed", {"var": "email"}]}, | ||
["red",25], | ||
["blue",25], | ||
["green",25], | ||
|
@@ -226,59 +224,6 @@ func TestFractionalEvaluation(t *testing.T) { | |
expectedValue: "#FF0000", | ||
expectedReason: model.TargetingMatchReason, | ||
}, | ||
"[email protected] with default seed": { | ||
flags: Flags{ | ||
Flags: map[string]model.Flag{ | ||
"headerColor": { | ||
State: "ENABLED", | ||
DefaultVariant: "red", | ||
Variants: map[string]any{ | ||
"red": "#FF0000", | ||
"blue": "#0000FF", | ||
"green": "#00FF00", | ||
"yellow": "#FFFF00", | ||
}, | ||
Targeting: []byte(`{ | ||
"if": [ | ||
{ | ||
"in": ["@faas.com", { | ||
"var": ["email"] | ||
}] | ||
}, | ||
{ | ||
"fractional": [ | ||
{"var": "email"}, | ||
[ | ||
"red", | ||
25 | ||
], | ||
[ | ||
"blue", | ||
25 | ||
], | ||
[ | ||
"green", | ||
25 | ||
], | ||
[ | ||
"yellow", | ||
25 | ||
] | ||
] | ||
}, null | ||
] | ||
}`), | ||
}, | ||
}, | ||
}, | ||
flagKey: "headerColor", | ||
context: map[string]any{ | ||
"email": "[email protected]", | ||
}, | ||
expectedVariant: "green", | ||
expectedValue: "#00FF00", | ||
expectedReason: model.TargetingMatchReason, | ||
}, | ||
"non even split": { | ||
flags: Flags{ | ||
Flags: map[string]model.Flag{ | ||
|
Submodule schemas
updated
from efefbb to 7e0749
Submodule test-harness
updated
from 3427ec to 2c792b