Skip to content

Commit f1870a7

Browse files
committed
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 <[email protected]>
1 parent a2abc78 commit f1870a7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/10apidoc/34room-messages.pl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ sub matrix_send_room_text_message
142142
matrix_sync( $user )
143143
})->then( sub {
144144
my ( $sync_body ) = @_;
145-
my $token = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch};
145+
my $next_batch = $sync_body->{next_batch};
146+
my $prev_batch = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch};
146147

147148
do_request_json_for( $user,
148149
method => "GET",
@@ -151,7 +152,8 @@ sub matrix_send_room_text_message
151152
# With no params this does "forwards from END"; i.e. nothing useful
152153
params => {
153154
dir => "b",
154-
from => $token,
155+
from => $next_batch,
156+
to => $prev_batch,
155157
},
156158
)
157159
})->then( sub {
@@ -180,7 +182,8 @@ sub matrix_send_room_text_message
180182
matrix_sync( $user )
181183
})->then( sub {
182184
my ( $sync_body ) = @_;
183-
my $token = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch};
185+
my $next_batch = $sync_body->{next_batch};
186+
my $prev_batch = $sync_body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch};
184187

185188
do_request_json_for( $user,
186189
method => "GET",
@@ -189,7 +192,8 @@ sub matrix_send_room_text_message
189192
params => {
190193
dir => "b",
191194
filter => '{ "lazy_load_members" : true }',
192-
from => $token,
195+
from => $next_batch,
196+
to => $prev_batch,
193197
},
194198
)
195199
})->then( sub {

0 commit comments

Comments
 (0)