-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for SYN-589, that old left rooms don't get sent down new links #139
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,69 @@ | |
}; | ||
|
||
|
||
test "Oldly left rooms don't appear in the leave section of sync", | ||
requires => [ local_user_fixture( with_events => 0 ), local_user_fixture( with_events => 0 ), | ||
qw( can_sync ) ], | ||
|
||
bug => 'SYN-589', | ||
|
||
check => sub { | ||
my ( $user, $user2 ) = @_; | ||
|
||
my ( $filter_id, $room_id_1, $room_id_2, $next ); | ||
|
||
my $filter = { | ||
room => { timeline => { limit => 1 }, include_leave => JSON::true } | ||
}; | ||
|
||
matrix_create_filter( $user, $filter )->then( sub { | ||
( $filter_id ) = @_; | ||
|
||
Future->needs_all( | ||
matrix_create_room( $user )->on_done( sub { ( $room_id_1 ) = @_; } ), | ||
matrix_create_room( $user )->on_done( sub { ( $room_id_2 ) = @_; } ), | ||
); | ||
})->then( sub { | ||
matrix_join_room( $user2, $room_id_1 ); | ||
})->then( sub { | ||
matrix_sync( $user, filter => $filter_id ); | ||
})->then( sub { | ||
my ( $body ) = @_; | ||
|
||
$next = $body->{next_batch}; | ||
|
||
Future->done(1); | ||
})->then( sub { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The combination of the above two lines is redundant; they can be deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ta |
||
matrix_leave_room( $user, $room_id_1 ); | ||
})->then( sub { | ||
matrix_sync( $user, filter => $filter_id ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to provide a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ta |
||
})->then( sub { | ||
my ( $body ) = @_; | ||
|
||
$next = $body->{next_batch}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need to assert that you definitely did see the newly-left room here, or is that checked already in another test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its tested elsewhere. I'm not sure how much I want to be complicating tests testing things that are tested elsewhere. I can do either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's tested elsewhere then no need to add it here, indeed. |
||
|
||
Future->done(1); | ||
})->then( sub { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ta |
||
Future->needs_all( map { | ||
matrix_put_room_state( $user2, $room_id_1, | ||
content => { "filler" => $_, membership => "join" }, | ||
type => "m.room.member", | ||
state_key => $user2->user_id, | ||
) | ||
} 0 .. 20 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going to create 21 items of filler state - is that number really necessary? Would the test work with fewer, or even just one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've lowered it and added back a comment. |
||
})->then( sub { | ||
matrix_sync( $user, filter => $filter_id, since => $next ); | ||
})->then( sub { | ||
my ( $body ) = @_; | ||
|
||
assert_json_keys( $body->{rooms}{leave} , qw( ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably don't want to use Instead you likely want something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cough |
||
|
||
Future->done(1); | ||
}); | ||
}; | ||
|
||
|
||
|
||
test "Left rooms appear in the leave section of full state sync", | ||
requires => [ local_user_fixture( with_events => 0 ), | ||
qw( can_sync ) ], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Oldly" ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hush