AppFlowy/rust-lib/flowy-dispatch/tests/api/module.rs

20 lines
457 B
Rust
Raw Normal View History

use crate::helper::*;
2021-07-08 13:23:44 +00:00
use flowy_dispatch::prelude::*;
pub async fn hello() -> String { "say hello".to_string() }
#[tokio::test]
async fn test_init() {
setup_env();
let event = "1";
2021-07-03 06:14:10 +00:00
init_dispatch(|| vec![Module::new().event(event, hello)]);
let request = ModuleRequest::new(event);
2021-07-16 15:18:12 +00:00
let _ = EventDispatch::async_send_with_callback(request, |resp| {
Box::pin(async move {
dbg!(&resp);
})
})
.await;
}