use super::Context;
use crate::blackboard::Blackboard;
impl Context {
pub fn blackboard(&self) -> &Blackboard {
&self.blackboard
}
}
#[cfg(all(test, not(feature = "messaging")))]
mod tests {
use super::*;
#[tokio::test]
async fn fresh_context_blackboard_starts_empty() {
let ctx = Context::new("blackboard-test-node")
.await
.expect("context should build without messaging");
assert!(ctx.blackboard().is_empty());
assert_eq!(ctx.blackboard().len(), 0);
}
#[tokio::test]
async fn context_clone_shares_the_same_blackboard() {
let ctx = Context::new("blackboard-test-node-clone")
.await
.expect("context should build without messaging");
let cloned = ctx.clone();
ctx.blackboard().set("key", serde_json::json!("value"));
assert_eq!(cloned.blackboard().get("key"), Some(serde_json::json!("value")));
}
}