Skip to content

Commit 7c21f88

Browse files
committed
test(sdk): Test SlidingSyncRoom::state.
1 parent c00b2db commit 7c21f88

File tree

1 file changed

+12
-11
lines changed
  • crates/matrix-sdk/src/sliding_sync

1 file changed

+12
-11
lines changed

crates/matrix-sdk/src/sliding_sync/room.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub struct SlidingSyncRoom {
4242
}
4343

4444
/// The state of a [`SlidingSyncRoom`].
45-
#[derive(Debug, Default, Clone)]
45+
#[derive(Debug, Default, Clone, PartialEq)]
4646
pub enum SlidingSyncRoomState {
4747
/// The room is not loaded, i.e. not updates have been received yet.
4848
#[default]
@@ -274,7 +274,7 @@ mod tests {
274274
use wiremock::MockServer;
275275

276276
use super::*;
277-
use crate::{error::Result, test_utils::logged_in_client};
277+
use crate::test_utils::logged_in_client;
278278

279279
macro_rules! room_response {
280280
( $( $json:tt )+ ) => {
@@ -292,13 +292,18 @@ mod tests {
292292
}
293293

294294
#[tokio::test]
295-
async fn test_room_room_id() -> Result<()> {
295+
async fn test_state() {
296+
let room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;
297+
298+
assert_eq!(room.state, SlidingSyncRoomState::NotLoaded);
299+
}
300+
301+
#[tokio::test]
302+
async fn test_room_room_id() {
296303
let room_id = room_id!("!foo:bar.org");
297304
let room = new_room(room_id, room_response!({})).await;
298305

299306
assert_eq!(room.room_id(), room_id);
300-
301-
Ok(())
302307
}
303308

304309
macro_rules! test_getters {
@@ -313,7 +318,7 @@ mod tests {
313318
) => {
314319
$(
315320
#[tokio::test]
316-
async fn $test_name () -> Result<()> {
321+
async fn $test_name () {
317322
// Default value.
318323
{
319324
let room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;
@@ -339,8 +344,6 @@ mod tests {
339344

340345
assert_eq!(room.$getter() $( . $getter_field )?, $second_value);
341346
}
342-
343-
Ok(())
344347
}
345348
)+
346349
};
@@ -397,7 +400,7 @@ mod tests {
397400
}
398401

399402
#[tokio::test]
400-
async fn test_required_state() -> Result<()> {
403+
async fn test_required_state() {
401404
// Default value.
402405
{
403406
let room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;
@@ -451,8 +454,6 @@ mod tests {
451454

452455
assert!(!room.required_state().is_empty());
453456
}
454-
455-
Ok(())
456457
}
457458

458459
#[test]

0 commit comments

Comments
 (0)