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

Function registry_replace_on_same_name

nodedb/tests/event_trigger.rs:194–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192
193#[test]
194fn registry_replace_on_same_name() {
195 let reg = TriggerRegistry::new();
196 reg.register(make_trigger(
197 "t1",
198 "orders",
199 true,
200 false,
201 false,
202 TriggerExecutionMode::Async,
203 ));
204 // Re-register with same name should replace.
205 let mut t = make_trigger(
206 "t1",
207 "orders",
208 false,
209 true,
210 false,
211 TriggerExecutionMode::Sync,
212 );
213 t.execution_mode = TriggerExecutionMode::Sync;
214 reg.register(t);
215
216 // Should match UPDATE now, not INSERT.
217 assert!(reg.get_matching(1, "orders", DmlEvent::Insert).is_empty());
218 let matched = reg.get_matching(1, "orders", DmlEvent::Update);
219 assert_eq!(matched.len(), 1);
220 assert_eq!(matched[0].execution_mode, TriggerExecutionMode::Sync);
221}
222
223#[test]
224fn registry_unregister() {

Callers

nothing calls this directly

Calls 3

get_matchingMethod · 0.80
make_triggerFunction · 0.70
registerMethod · 0.45

Tested by

no test coverage detected