diff --git a/ubisync/src/comm/mod.rs b/ubisync/src/comm/mod.rs index 5b668f4..27c18c8 100644 --- a/ubisync/src/comm/mod.rs +++ b/ubisync/src/comm/mod.rs @@ -196,57 +196,10 @@ impl CommHandle { } #[cfg(test)] -mod tests { - use std::time::Duration; - - use i2p::net::I2pListener; +mod tests {use i2p::net::I2pListener; use i2p::sam::StreamForward; use i2p::sam_options::SAMOptions; use i2p::Session; - use ubisync_lib::messages::{Message, self}; - use ubisync_lib::types::ElementId; - - use crate::state::{CommState, State}; - use crate::Config; - - use super::CommHandle; - #[tokio::test(flavor = "multi_thread")] - pub async fn msg() { - let ch = CommHandle::new( - CommState::new(State::new().await.unwrap()), - &Config::default(), - ) - .unwrap(); - ch.run().await; - println!("My address: {:?}", ch.i2p_b32_address()); - - ch.send( - &ch.i2p_address().unwrap(), - Message::new(messages::MessageContent::Hello { - peer_name: "a".to_string(), - }), - ) - .await - .expect("Could not send hello"); - for i in 0..10 { - let result = ch - .send( - &ch.i2p_address().unwrap(), - Message::new(messages::MessageContent::CreateElement { - id: ElementId::new(), - content: ubisync_lib::types::ElementContent::Text(format!( - "hello world no. {}", - i - )), - }), - ) - .await; - tokio::time::sleep(Duration::from_millis(300)).await; - println!("Result of sending: {:?}", result); - } - - ch.stop().await; - } #[test] pub fn from_privkey() {