Skip to content

Commit

Permalink
Add test asserting presence is set from the set_presence param to sync (
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr authored Apr 8, 2022
1 parent d9be56c commit 69c873b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/40presence.pl
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,29 @@
Future->done(1);
});
};

test "Presence can be set from sync",
requires => [ $senduser_fixture, $local_user_fixture ],

proves => [qw( can_sync )],

do => sub {
my ( $senduser, $recvuser ) = @_;

matrix_sync( $senduser, timeout => 0, set_presence => 'unavailable' ) ->then( sub {
my ( $body ) = @_;

await_sync_presence_contains( $recvuser, check => sub {
my ( $event ) = @_;
return unless $event->{type} eq "m.presence";

assert_json_keys( $event, qw( type content sender ));
assert_json_keys( $event->{content}, qw( presence last_active_ago ));
$event->{sender} eq $senduser->user_id or return;
$event->{content}->{presence} eq 'unavailable' or
die "Expected content presence to be 'unavailable'";

return 1;
});
})->then_done(1);
};

0 comments on commit 69c873b

Please sign in to comment.