@@ -176,7 +176,7 @@ pub mod tests {
176
176
"some_segment_id_1" . into ( ) ,
177
177
Segment {
178
178
name : "" . into ( ) ,
179
- segment_id : "" . into ( ) ,
179
+ segment_id : "some_segment_id_1 " . into ( ) ,
180
180
description : "" . into ( ) ,
181
181
tags : None ,
182
182
rules : vec ! [ SegmentRule {
@@ -252,11 +252,6 @@ pub mod tests {
252
252
panic ! ( "Error type mismatch!" ) ;
253
253
} ;
254
254
assert_eq ! ( segment_id, "non_existing_segment_id" ) ;
255
- // let msg = rule.unwrap_err().to_string();
256
- // assert!(msg.contains("'a2'"));
257
- // assert!(msg.contains("'0'"));
258
- // assert!(msg.contains("'non_existing_segment_id'"));
259
- // assert!(msg.contains("not found"));
260
255
}
261
256
262
257
// SCENARIO - evaluating an operator fails. Meaning, [for example] user has added a numeric value(int/float) in appconfig segment attribute, but in their application they pass the attribute with a boolean value.
@@ -269,13 +264,6 @@ pub mod tests {
269
264
} ;
270
265
let rule =
271
266
find_applicable_segment_rule_for_entity ( & segments, segment_rules. into_iter ( ) , & entity) ;
272
- // Error message should look something like this:
273
- // Failed to evaluate entity: Failed to evaluate entity 'a2' against targeting rule '0'.
274
- // Caused by: Failed to evaluate segment 'some_segment_id_1'
275
- // Caused by: Operation 'name' 'is' 'heinz' failed to evaluate.
276
- // Caused by: Entity attribute has unexpected type: Number.
277
- // We are checking here that the parts are present to allow debugging of config by the user:
278
-
279
267
let e = rule. unwrap_err ( ) ;
280
268
assert ! ( matches!( e, Error :: EntityEvaluationError ( _) ) ) ;
281
269
let Error :: EntityEvaluationError ( EntityEvaluationError (
@@ -284,7 +272,7 @@ pub mod tests {
284
272
else {
285
273
panic ! ( "Error type mismatch!" ) ;
286
274
} ;
287
- assert_eq ! ( error. segment . name , "" ) ;
275
+ assert_eq ! ( error. segment_id , "some_segment_id_1 " ) ;
288
276
assert_eq ! ( error. segment_rule. attribute_name, "name" ) ;
289
277
assert_eq ! ( error. value, "heinz" ) ;
290
278
}
0 commit comments