MCPcopy Create free account
hub / github.com/FeatureProbe/server-sdk-rust / test_segment_condition

Function test_segment_condition

src/evaluate.rs:663–677  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

661
662 #[test]
663 fn test_segment_condition() {
664 let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
665 path.push("resources/fixtures/repo.json");
666 let json_str = fs::read_to_string(path).unwrap();
667 let repo = load_json(&json_str);
668 assert!(repo.is_ok());
669 let repo = repo.unwrap();
670
671 let user = FPUser::new().with("city", "4");
672 let toggle = repo.toggles.get("json_toggle").unwrap();
673 let r = toggle.eval(&user, &repo.segments, &repo.toggles, false, MAX_DEEP, None);
674 let r = r.value.unwrap();
675 let r = r.as_object().unwrap();
676 assert!(r.get("variation_1").is_some());
677 }
678
679 #[test]
680 fn test_not_in_segment_condition() {

Callers

nothing calls this directly

Calls 4

load_jsonFunction · 0.85
withMethod · 0.80
getMethod · 0.80
evalMethod · 0.45

Tested by

no test coverage detected