MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / not_null_violation

Function not_null_violation

nodedb-crdt/src/validator/tests.rs:46–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45#[test]
46fn not_null_violation() {
47 let (_state, cs) = setup();
48 let validator = Validator::new(cs, 100);
49 let state = CrdtState::new(1).unwrap();
50
51 let change = ProposedChange {
52 collection: "users".into(),
53 row_id: "u1".into(),
54 surrogate: nodedb_types::Surrogate::ZERO,
55 fields: vec![(
56 "email".into(),
57 LoroValue::String("alice@example.com".into()),
58 )],
59 };
60
61 match validator.validate(&state, &change) {
62 ValidationOutcome::Rejected(v) => {
63 assert_eq!(v.len(), 1);
64 assert_eq!(v[0].constraint_name, "users_name_nn");
65 assert!(matches!(
66 v[0].hint,
67 CompensationHint::ProvideRequiredField { .. }
68 ));
69 }
70 _ => panic!("expected rejection"),
71 }
72}
73
74#[test]
75fn foreign_key_violation() {

Callers

nothing calls this directly

Calls 2

setupFunction · 0.70
validateMethod · 0.45

Tested by

no test coverage detected