feature(relay): added first basic tests for relay component

This commit is contained in:
Patryk Hegenberg 2024-04-28 11:18:48 +02:00
parent 26f09218f4
commit 76e48923d5
3 changed files with 33 additions and 0 deletions

View file

@ -46,4 +46,18 @@ impl AppState {
rooms: HashMap::new(),
}))
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::sync::{Arc};
#[test]
fn test_new() {
let app_state = AppState::new();
assert!(Arc::ptr_eq(&app_state, &app_state.clone()));
}
}

View file

@ -488,3 +488,9 @@ impl Client {
self.handle_leave_room(server).await
}
}
// TODO: Add tests
#[cfg(test)]
mod tests {
use super::*;
}

View file

@ -71,3 +71,16 @@ impl Room {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_room_new() {
let room = Room::new(5);
assert_eq!(room.size, 5);
assert!(room.senders.is_empty());
}
}