test(integration): Fix test_room_notification_count.

This test was failing since the migration from the sliding sync proxy
to Synapse.

This patch fixes the test. The failing parts were:

1. The `timeline_limit` wasn't set, so Synapse was returning an error,
2. The `unread_notifications` was set to 0 and could not be set to 1
   because that's an encrypted room.

The fact `timeline_limit` is now mandatory has been mentioned in the MSC:
https://github.com/matrix-org/matrix-spec-proposals/pull/4186/files#r1775138458
A patch in Ruma has been created. The previous patch in this repository
also contains the fix for the SDK side.

The assertions around `unread_notifications` have been removed. We no
longer use this API anymore (and it should be deprecated by the way).
This commit is contained in:
Ivan Enderlin
2024-09-25 15:21:21 +02:00
parent 2562aa3fee
commit 83ce4c7ca2

View File

@@ -359,7 +359,6 @@ impl UpdateObserver {
}
#[tokio::test]
#[ignore]
async fn test_room_notification_count() -> Result<()> {
use tokio::time::timeout;
@@ -488,20 +487,6 @@ async fn test_room_notification_count() -> Result<()> {
assert_eq!(alice_room.num_unread_notifications(), 1);
assert_eq!(alice_room.num_unread_mentions(), 0);
// If the server hasn't updated the server-side notification count yet, wait for
// it and reassert.
if alice_room.unread_notification_counts().notification_count != 1 {
update_observer
.next()
.await
.expect("server should update server-side notification count");
assert_eq!(alice_room.unread_notification_counts().notification_count, 1);
assert_eq!(alice_room.num_unread_messages(), 1);
assert_eq!(alice_room.num_unread_notifications(), 1);
assert_eq!(alice_room.num_unread_mentions(), 0);
}
update_observer.assert_is_pending();
}
@@ -525,20 +510,6 @@ async fn test_room_notification_count() -> Result<()> {
assert_eq!(alice_room.num_unread_notifications(), 2);
assert_eq!(alice_room.num_unread_mentions(), 1);
// If the server hasn't updated the server-side notification count yet, wait for
// it and reassert.
if alice_room.unread_notification_counts().notification_count != 2 {
update_observer
.next()
.await
.expect("server should update server-side notification count");
assert_eq!(alice_room.unread_notification_counts().notification_count, 2);
assert_eq!(alice_room.num_unread_messages(), 2);
assert_eq!(alice_room.num_unread_notifications(), 2);
assert_eq!(alice_room.num_unread_mentions(), 1);
}
update_observer.assert_is_pending();
}