Skip to content

Commit

Permalink
Fix presence sync test to use await_sync_presence_contains
Browse files Browse the repository at this point in the history
Otherwise it doesn't work with workers
  • Loading branch information
erikjohnston committed Mar 22, 2019
1 parent 5df355c commit 0d59907
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions tests/31sync/05presence.pl
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,16 @@
# Set user B's presence to online by syncing.
matrix_sync( $user_b, filter => $filter_id_b );
})->then( sub {
matrix_sync_again( $user_a, filter => $filter_id_a, timeout => 1000 );
})->then( sub {
my ( $body ) = @_;
await_sync_presence_contains( $user_a, check => sub {
my ( $presence ) = @_;

log_if_fail "sync body", $body;
log_if_fail "Presence event", $presence;

my $events = $body->{presence}{events};
my $presence = first { $_->{type} eq "m.presence" } @$events
or die "Expected to see B's presence";
return unless $presence->{sender} eq $user_b->user_id;

$presence->{sender} eq $user_b->user_id or die "Unexpected sender";
$presence->{content}{presence} eq "online"
or die "Expected B to be online";
assert_eq( $presence->{content}{presence}, "online");

Future->done(1);
return 1;
});
})
};

0 comments on commit 0d59907

Please sign in to comment.