Skip to content

Commit

Permalink
Use correct start and stop to get the message
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kroeckx committed Jul 17, 2021
1 parent a2abc78 commit f1870a7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/10apidoc/34room-messages.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 {
Expand Down Expand Up @@ -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",
Expand All @@ -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 {
Expand Down

0 comments on commit f1870a7

Please sign in to comment.