base: Change receipt store tests' user ID

master
Kévin Commaille 2021-05-25 14:20:13 +02:00
parent 49c72e74f7
commit f619bbb884
No known key found for this signature in database
GPG Key ID: 296D60AE1E61661C
2 changed files with 14 additions and 12 deletions

View File

@ -515,12 +515,15 @@ mod test {
use super::{MemoryStore, StateChanges}; use super::{MemoryStore, StateChanges};
fn user_id() -> UserId {
user_id!("@example:localhost")
}
#[async_test] #[async_test]
async fn test_receipts_saving() { async fn test_receipts_saving() {
let store = MemoryStore::new(); let store = MemoryStore::new();
let room_id = room_id!("!test:localhost"); let room_id = room_id!("!test:localhost");
let user_id = user_id!("@rikj:jki.re");
let first_event_id = event_id!("$1435641916114394fHBLK:matrix.org"); let first_event_id = event_id!("$1435641916114394fHBLK:matrix.org");
let second_event_id = event_id!("$fHBLK1435641916114394:matrix.org"); let second_event_id = event_id!("$fHBLK1435641916114394:matrix.org");
@ -528,7 +531,7 @@ mod test {
let first_receipt_event = serde_json::from_value(json!({ let first_receipt_event = serde_json::from_value(json!({
first_event_id.clone(): { first_event_id.clone(): {
"m.read": { "m.read": {
user_id.clone(): { user_id(): {
"ts": 1436451550453u64 "ts": 1436451550453u64
} }
} }
@ -539,7 +542,7 @@ mod test {
let second_receipt_event = serde_json::from_value(json!({ let second_receipt_event = serde_json::from_value(json!({
second_event_id.clone(): { second_event_id.clone(): {
"m.read": { "m.read": {
user_id.clone(): { user_id(): {
"ts": 1436451551453u64 "ts": 1436451551453u64
} }
} }
@ -548,7 +551,7 @@ mod test {
.unwrap(); .unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_none()); .is_none());
@ -568,7 +571,7 @@ mod test {
store.save_changes(&changes).await.unwrap(); store.save_changes(&changes).await.unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_some(),); .is_some(),);
@ -591,7 +594,7 @@ mod test {
store.save_changes(&changes).await.unwrap(); store.save_changes(&changes).await.unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_some()); .is_some());

View File

@ -936,7 +936,6 @@ mod test {
let store = SledStore::open().unwrap(); let store = SledStore::open().unwrap();
let room_id = room_id!("!test:localhost"); let room_id = room_id!("!test:localhost");
let user_id = user_id!("@rikj:jki.re");
let first_event_id = event_id!("$1435641916114394fHBLK:matrix.org"); let first_event_id = event_id!("$1435641916114394fHBLK:matrix.org");
let second_event_id = event_id!("$fHBLK1435641916114394:matrix.org"); let second_event_id = event_id!("$fHBLK1435641916114394:matrix.org");
@ -944,7 +943,7 @@ mod test {
let first_receipt_event = serde_json::from_value(json!({ let first_receipt_event = serde_json::from_value(json!({
first_event_id.clone(): { first_event_id.clone(): {
"m.read": { "m.read": {
user_id.clone(): { user_id(): {
"ts": 1436451550453u64 "ts": 1436451550453u64
} }
} }
@ -955,7 +954,7 @@ mod test {
let second_receipt_event = serde_json::from_value(json!({ let second_receipt_event = serde_json::from_value(json!({
second_event_id.clone(): { second_event_id.clone(): {
"m.read": { "m.read": {
user_id.clone(): { user_id(): {
"ts": 1436451551453u64 "ts": 1436451551453u64
} }
} }
@ -964,7 +963,7 @@ mod test {
.unwrap(); .unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_none()); .is_none());
@ -984,7 +983,7 @@ mod test {
store.save_changes(&changes).await.unwrap(); store.save_changes(&changes).await.unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_some(),); .is_some(),);
@ -1007,7 +1006,7 @@ mod test {
store.save_changes(&changes).await.unwrap(); store.save_changes(&changes).await.unwrap();
assert!(store assert!(store
.get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id) .get_user_room_receipt_event(&room_id, ReceiptType::Read, &user_id())
.await .await
.unwrap() .unwrap()
.is_some()); .is_some());