Skip to content

Commit

Permalink
test(integration_tests): remove unneeded test
Browse files Browse the repository at this point in the history
  • Loading branch information
torrybr committed Jul 23, 2024
1 parent 5b1e32c commit 02069b7
Showing 1 changed file with 1 addition and 57 deletions.
58 changes: 1 addition & 57 deletions crates/matrix-sdk-base/src/store/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Trait and macro of integration tests for StateStore implementations.
use std::{
collections::{BTreeMap, BTreeSet},
time::Duration,
};
use std::collections::{BTreeMap, BTreeSet};

use assert_matches::assert_matches;
use assert_matches2::assert_let;
Expand All @@ -14,7 +11,6 @@ use ruma::{
api::{client::media::get_content_thumbnail::v3::Method, MatrixVersion},
event_id,
events::{
beacon_info::BeaconInfoEventContent,
presence::PresenceEvent,
receipt::{ReceiptThread, ReceiptType},
room::{
Expand Down Expand Up @@ -95,8 +91,6 @@ pub trait StateStoreIntegrationTests {
async fn test_send_queue(&self);
/// Test saving/restoring server capabilities.
async fn test_server_capabilities_saving(&self);
/// Test saving live location share beacons
async fn test_beacon_saving(&self);
}

#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
Expand Down Expand Up @@ -1487,30 +1481,6 @@ impl StateStoreIntegrationTests for DynStateStore {
assert!(outstanding_rooms.iter().any(|room| room == room_id));
assert!(outstanding_rooms.iter().any(|room| room == room_id2));
}

async fn test_beacon_saving(&self) {
let room_id = room_id!("!test_beacon_saving:localhost");

let raw_event = custom_beacon_info_event(user_id(), true, 1234567890);
let event = raw_event.deserialize().unwrap();

assert!(self
.get_state_event(room_id, StateEventType::BeaconInfo, user_id().as_str())
.await
.unwrap()
.is_none());

let mut changes = StateChanges::default();
changes.add_state_event(room_id, event, raw_event);

self.save_changes(&changes).await.unwrap();

assert!(self
.get_state_event(room_id, StateEventType::BeaconInfo, user_id().as_str())
.await
.unwrap()
.is_some());
}
}

/// Macro building to allow your StateStore implementation to run the entire
Expand Down Expand Up @@ -1679,12 +1649,6 @@ macro_rules! statestore_integration_tests {
let store = get_store().await.expect("creating store failed").into_state_store();
store.test_send_queue().await;
}

#[async_test]
async fn test_beacon_saving() {
let store = get_store().await.expect("creating store failed").into_state_store();
store.test_beacon_saving().await;
}
};
}

Expand Down Expand Up @@ -1765,23 +1729,3 @@ fn custom_presence_event(user_id: &UserId) -> Raw<PresenceEvent> {

Raw::new(&ev_json).unwrap().cast()
}

fn custom_beacon_info_event(
user_id: &UserId,
live: bool,
duration_millis: u64,
) -> Raw<AnySyncStateEvent> {
let content =
BeaconInfoEventContent::new(None, Duration::from_millis(duration_millis), live, None);

let event = json!({
"event_id": "$h29iv0s8:example.com",
"content": content,
"sender": user_id,
"type": "org.matrix.msc3672.beacon_info",
"origin_server_ts": 0u64,
"state_key": user_id,
});

serde_json::from_value(event).unwrap()
}

0 comments on commit 02069b7

Please sign in to comment.