feature(relay): added first basic tests for relay component
This commit is contained in:
parent
26f09218f4
commit
76e48923d5
3 changed files with 33 additions and 0 deletions
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
@ -488,3 +488,9 @@ impl Client {
|
|||
self.handle_leave_room(server).await
|
||||
}
|
||||
}
|
||||
// TODO: Add tests
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
}
|
||||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue