Skip to content

Commit

Permalink
invalid jsonlogic rule
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant committed Jan 8, 2025
1 parent 724609c commit 0c3da5e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/flag/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,22 @@ func TestRule_Evaluate(t *testing.T) {
wantErr: assert.NoError,
want: "variation_B",
},
{
name: "Invalid JsonLogic logic rule",
rule: flag.Rule{
Name: testconvert.String("rule1"),
Percentages: &map[string]float64{
"variation_D": 70,
"variation_C": 10,
"variation_B": 20,
},
Query: testconvert.String(`{"=": [{"var": "key"}, "96ac59e6-7492-436b-b15a-ba1d797d2423"]}`),
},
args: args{
user: ffcontext.NewEvaluationContext("96ac59e6-7492-436b-b15a-ba1d797d2423"),
},
wantErr: assert.Error,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 0c3da5e

Please sign in to comment.