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