Skip to content

Commit 0f9f9d5

Browse files
committed
more tests
1 parent 531f5c2 commit 0f9f9d5

File tree

1 file changed

+36
-1
lines changed
  • relay-event-normalization/src/eap

1 file changed

+36
-1
lines changed

relay-event-normalization/src/eap/ai.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod tests {
107107
use std::collections::HashMap;
108108

109109
use relay_pattern::Pattern;
110-
use relay_protocol::assert_annotated_snapshot;
110+
use relay_protocol::{Empty, assert_annotated_snapshot};
111111

112112
use crate::ModelCostV2;
113113

@@ -352,4 +352,39 @@ mod tests {
352352
}
353353
"#);
354354
}
355+
356+
#[test]
357+
fn test_normalize_ai_no_ai_attributes() {
358+
let mut attributes = Annotated::new(attributes! {
359+
"foo" => 123,
360+
});
361+
362+
normalize_ai(
363+
&mut attributes,
364+
Some(Duration::from_millis(500)),
365+
Some(&model_costs()),
366+
);
367+
368+
assert_annotated_snapshot!(&mut attributes, @r#"
369+
{
370+
"foo": {
371+
"type": "integer",
372+
"value": 123
373+
}
374+
}
375+
"#);
376+
}
377+
378+
#[test]
379+
fn test_normalize_ai_empty() {
380+
let mut attributes = Annotated::empty();
381+
382+
normalize_ai(
383+
&mut attributes,
384+
Some(Duration::from_millis(500)),
385+
Some(&model_costs()),
386+
);
387+
388+
assert!(attributes.is_empty());
389+
}
355390
}

0 commit comments

Comments
 (0)