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