@@ -80,18 +80,18 @@ func Test_Bulk_Evaluation(t *testing.T) {
80
80
},
81
81
want : want {
82
82
httpCode : http .StatusBadRequest ,
83
- bodyFile : "../testdata/ofrep/responses/nil_context .json" ,
83
+ bodyFile : "../testdata/ofrep/responses/nil_context_updated .json" ,
84
84
},
85
85
},
86
86
{
87
- name : "No Targeting Key in context" ,
87
+ name : "No Targeting Key in context - should now pass and evaluate flags individually " ,
88
88
args : args {
89
89
bodyFile : "../testdata/ofrep/no_targeting_key_context.json" ,
90
90
configFlagsLocation : configFlagsLocation ,
91
91
},
92
92
want : want {
93
- httpCode : http .StatusBadRequest ,
94
- bodyFile : "../testdata/ofrep/responses/no_targeting_key_context .json" ,
93
+ httpCode : http .StatusOK ,
94
+ bodyFile : "../testdata/ofrep/responses/no_targeting_key_context_updated .json" ,
95
95
},
96
96
},
97
97
}
@@ -205,19 +205,43 @@ func Test_Evaluate(t *testing.T) {
205
205
},
206
206
want : want {
207
207
httpCode : http .StatusBadRequest ,
208
- bodyFile : "../testdata/ofrep/responses/nil_context_with_key .json" ,
208
+ bodyFile : "../testdata/ofrep/responses/nil_context_with_key_updated .json" ,
209
209
},
210
210
},
211
211
{
212
- name : "No Targeting Key in context " ,
212
+ name : "No Targeting Key for bucketing-required flag - should return 400 from core evaluation " ,
213
213
args : args {
214
214
bodyFile : "../testdata/ofrep/no_targeting_key_context.json" ,
215
215
configFlagsLocation : configFlagsLocation ,
216
- flagKey : "number-flag" ,
216
+ flagKey : "number-flag" , // This flag has percentage rules, requires bucketing
217
217
},
218
218
want : want {
219
219
httpCode : http .StatusBadRequest ,
220
- bodyFile : "../testdata/ofrep/responses/no_targeting_key_context_with_key.json" ,
220
+ bodyFile : "../testdata/ofrep/responses/no_targeting_key_bucketing_flag.json" ,
221
+ },
222
+ },
223
+ {
224
+ name : "No Targeting Key for non-bucketing flag - should succeed" ,
225
+ args : args {
226
+ bodyFile : "../testdata/ofrep/no_targeting_key_context.json" ,
227
+ configFlagsLocation : configFlagsLocation ,
228
+ flagKey : "targeting-key-rule" , // This flag has no percentages, doesn't require bucketing
229
+ },
230
+ want : want {
231
+ httpCode : http .StatusOK ,
232
+ bodyFile : "../testdata/ofrep/responses/no_targeting_key_static_flag.json" ,
233
+ },
234
+ },
235
+ {
236
+ name : "Percentage-based flag without targeting key should return 400 error" ,
237
+ args : args {
238
+ bodyFile : "../testdata/ofrep/no_targeting_key_context.json" ,
239
+ configFlagsLocation : configFlagsLocation ,
240
+ flagKey : "flag-only-for-admin" , // This flag has percentage rules, requires bucketing
241
+ },
242
+ want : want {
243
+ httpCode : http .StatusBadRequest , // Core evaluation returns 400 for missing targeting key
244
+ bodyFile : "../testdata/ofrep/responses/percentage_flag_no_key_error.json" ,
221
245
},
222
246
},
223
247
{
0 commit comments