From f1870a7175612028297f1a724a57050222d3bb75 Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Sat, 17 Jul 2021 11:12:14 +0200 Subject: [PATCH] Use correct start and stop to get the message The output of /sync without since parameter has the most recent message events, and so should include at least the message we just sent. The tests used prev_batch, but this should point before the message that was returned in /sync. Starting backward from an event before the test message should not have received any message. We now test between next_batch and prev_batch, we should get the message. Signed-off-by: Kurt Roeckx --- tests/10apidoc/34room-messages.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/10apidoc/34room-messages.pl b/tests/10apidoc/34room-messages.pl index fc7e1c1bd..3d1f90a49 100644 --- a/tests/10apidoc/34room-messages.pl +++ b/tests/10apidoc/34room-messages.pl @@ -142,7 +142,8 @@ sub matrix_send_room_text_message matrix_sync( $user ) })->then( sub { my ( $sync_body ) = @_; - my $token = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch}; + my $next_batch = $sync_body->{next_batch}; + my $prev_batch = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch}; do_request_json_for( $user, method => "GET", @@ -151,7 +152,8 @@ sub matrix_send_room_text_message # With no params this does "forwards from END"; i.e. nothing useful params => { dir => "b", - from => $token, + from => $next_batch, + to => $prev_batch, }, ) })->then( sub { @@ -180,7 +182,8 @@ sub matrix_send_room_text_message matrix_sync( $user ) })->then( sub { my ( $sync_body ) = @_; - my $token = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch}; + my $next_batch = $sync_body->{next_batch}; + my $prev_batch = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch}; do_request_json_for( $user, method => "GET", @@ -189,7 +192,8 @@ sub matrix_send_room_text_message params => { dir => "b", filter => '{ "lazy_load_members" : true }', - from => $token, + from => $next_batch, + to => $prev_batch, }, ) })->then( sub {