Skip to content

Commit

Permalink
Merge pull request #735 from matrix-org/erikj/case_insensitive_room_dir
Browse files Browse the repository at this point in the history
Tests for room dir search
  • Loading branch information
erikjohnston authored Oct 31, 2019
2 parents 5c7ea15 + 2dc573e commit 43795c1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/30rooms/70publicroomslist.pl
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,49 @@
Future->done( 1 );
})
};

test "Can search public room list",
requires => [ $main::HOMESERVER_INFO[0], local_user_fixture() ],

check => sub {
my ( $info, $local_user ) = @_;

my $room_id;

matrix_create_room( $local_user,
visibility => "public",
name => "Test Name",
topic => "Test Topic Wombles",
)->then( sub {
( $room_id ) = @_;

retry_until_success {
do_request_json_for( $local_user,
method => "POST",
uri => "/r0/publicRooms",

content => {
filter => {
generic_search_term => "wombles", # Search case insesitively
}
},
)->then( sub {
my ( $body ) = @_;

log_if_fail "Body", $body;

assert_json_keys( $body, qw( chunk ) );

# We only expect to find a single result
assert_eq( scalar @{ $body->{chunk} }, 1 );
assert_eq( $body->{chunk}[0]{room_id}, $room_id );

Future->done( 1 );
})->on_fail( sub {
my ( $exc ) = @_;
chomp $exc;
log_if_fail "Failed to search room dir: $exc";
});
}
})
};

0 comments on commit 43795c1

Please sign in to comment.