From ffbe2550fb391f283ea43f37a02438d8e562e7d6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 5 Jan 2016 14:25:33 +0000 Subject: [PATCH] Neaten up code. Equivalent semantics. --- tests/30rooms/12thirdpartyinvite.pl | 78 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/tests/30rooms/12thirdpartyinvite.pl b/tests/30rooms/12thirdpartyinvite.pl index a41e22885..7faea4573 100644 --- a/tests/30rooms/12thirdpartyinvite.pl +++ b/tests/30rooms/12thirdpartyinvite.pl @@ -25,31 +25,30 @@ $id_server->bind_identity( undef, "email", $invitee_email, $invitee ) ->then( sub { matrix_create_and_join_room( [ $inviter ], visibility => "private" ) - ->then( sub { - ( $room_id ) = @_; - - do_request_json_for( $inviter, - method => "POST", - uri => "/api/v1/rooms/$room_id/invite", - - content => { - id_server => $id_server->name, - medium => "email", - address => $invitee_email, - }, - ); - })->then( sub { - matrix_get_room_state( $inviter, $room_id, - type => "m.room.member", - state_key => $invitee_mxid, - )->on_done( sub { - my ( $body ) = @_; - - log_if_fail "Body", $body; - $body->{membership} eq "invite" or - die "Expected invited user membership to be 'invite'"; - }); - }); + })->then( sub { + ( $room_id ) = @_; + + do_request_json_for( $inviter, + method => "POST", + uri => "/api/v1/rooms/$room_id/invite", + + content => { + id_server => $id_server->name, + medium => "email", + address => $invitee_email, + }, + ); + })->then( sub { + matrix_get_room_state( $inviter, $room_id, + type => "m.room.member", + state_key => $invitee_mxid, + ); + })->on_done( sub { + my ( $body ) = @_; + + log_if_fail "Body", $body; + assert_eq( $body->{membership}, "invite", + 'invited user membership' ); }); }; @@ -70,21 +69,20 @@ address => $invitee_email, id_server => $id_server->name, }; - matrix_create_room( $inviter, invite_3pid => [ $invite_info ] ) - ->then( sub { - ( $room_id ) = @_; - - matrix_get_room_state( $inviter, $room_id, - type => "m.room.member", - state_key => $invitee_mxid, - )->on_done( sub { - my ( $body ) = @_; - - log_if_fail "Body", $body; - assert_eq( $body->{membership}, "invite", - 'invited user membership' ); - }); - }); + matrix_create_room( $inviter, invite_3pid => [ $invite_info ] ); + })->then( sub { + ( $room_id ) = @_; + + matrix_get_room_state( $inviter, $room_id, + type => "m.room.member", + state_key => $invitee_mxid, + ); + })->on_done( sub { + my ( $body ) = @_; + + log_if_fail "Body", $body; + assert_eq( $body->{membership}, "invite", + 'invited user membership' ); }); };