@@ -7,6 +7,7 @@ import 'package:crypto/crypto.dart';
7
7
import 'package:fake_async/fake_async.dart' ;
8
8
import 'package:http/http.dart' as http;
9
9
import 'package:test/scaffolding.dart' ;
10
+ import 'package:zulip/api/exception.dart' ;
10
11
import 'package:zulip/api/model/events.dart' ;
11
12
import 'package:zulip/api/model/model.dart' ;
12
13
import 'package:zulip/api/model/submessage.dart' ;
@@ -603,8 +604,8 @@ void main() {
603
604
604
605
connection.prepare (
605
606
json: UpdateMessageResult ().toJson (), delay: Duration (seconds: 1 ));
606
- store.editMessage (messageId: message.id,
607
- originalRawContent: 'old content' , newContent: 'new content' );
607
+ unawaited ( store.editMessage (messageId: message.id,
608
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
608
609
checkRequest (message.id,
609
610
prevContent: 'old content' ,
610
611
content: 'new content' );
@@ -634,8 +635,8 @@ void main() {
634
635
635
636
connection.prepare (
636
637
json: UpdateMessageResult ().toJson (), delay: Duration (seconds: 1 ));
637
- store.editMessage (messageId: message.id,
638
- originalRawContent: 'old content' , newContent: 'new content' );
638
+ unawaited ( store.editMessage (messageId: message.id,
639
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
639
640
checkRequest (message.id,
640
641
prevContent: 'old content' ,
641
642
content: 'new content' );
@@ -647,8 +648,8 @@ void main() {
647
648
check (store.getEditMessageErrorStatus (otherMessage.id)).isNull ();
648
649
connection.prepare (
649
650
json: UpdateMessageResult ().toJson (), delay: Duration (seconds: 1 ));
650
- store.editMessage (messageId: otherMessage.id,
651
- originalRawContent: 'other message old content' , newContent: 'other message new content' );
651
+ unawaited ( store.editMessage (messageId: otherMessage.id,
652
+ originalRawContent: 'other message old content' , newContent: 'other message new content' )) ;
652
653
checkRequest (otherMessage.id,
653
654
prevContent: 'other message old content' ,
654
655
content: 'other message new content' );
@@ -682,8 +683,8 @@ void main() {
682
683
check (store.getEditMessageErrorStatus (message.id)).isNull ();
683
684
684
685
connection.prepare (apiException: eg.apiBadRequest (), delay: Duration (seconds: 1 ));
685
- store.editMessage (messageId: message.id,
686
- originalRawContent: 'old content' , newContent: 'new content' );
686
+ unawaited ( check ( store.editMessage (messageId: message.id,
687
+ originalRawContent: 'old content' , newContent: 'new content' )). throws < ZulipApiException >()) ;
687
688
checkNotifiedOnce ();
688
689
async .elapse (Duration (seconds: 1 ));
689
690
check (store.getEditMessageErrorStatus (message.id)).isNotNull ().isTrue ();
@@ -695,8 +696,8 @@ void main() {
695
696
check (store.getEditMessageErrorStatus (message.id)).isNull ();
696
697
697
698
connection.prepare (apiException: eg.apiBadRequest (), delay: Duration (seconds: 1 ));
698
- store.editMessage (messageId: message.id,
699
- originalRawContent: 'old content' , newContent: 'new content' );
699
+ unawaited ( check ( store.editMessage (messageId: message.id,
700
+ originalRawContent: 'old content' , newContent: 'new content' )). throws < ZulipApiException >()) ;
700
701
checkNotifiedOnce ();
701
702
async .elapse (Duration (seconds: 1 ));
702
703
check (store.getEditMessageErrorStatus (message.id)).isNotNull ().isTrue ();
@@ -718,8 +719,8 @@ void main() {
718
719
719
720
connection.prepare (
720
721
json: UpdateMessageResult ().toJson (), delay: Duration (seconds: 1 ));
721
- store.editMessage (messageId: message.id,
722
- originalRawContent: 'old content' , newContent: 'new content' );
722
+ unawaited ( store.editMessage (messageId: message.id,
723
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
723
724
async .elapse (Duration (milliseconds: 500 ));
724
725
check (connection.takeRequests ()).length.equals (1 );
725
726
checkNotifiedOnce ();
@@ -738,8 +739,8 @@ void main() {
738
739
739
740
connection.prepare (
740
741
httpException: const SocketException ('failed' ), delay: Duration (seconds: 1 ));
741
- store.editMessage (messageId: message.id,
742
- originalRawContent: 'old content' , newContent: 'new content' );
742
+ unawaited ( store.editMessage (messageId: message.id,
743
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
743
744
checkNotifiedOnce ();
744
745
745
746
async .elapse (Duration (milliseconds: 500 ));
@@ -760,8 +761,8 @@ void main() {
760
761
761
762
connection.prepare (
762
763
httpException: const SocketException ('failed' ), delay: Duration (seconds: 1 ));
763
- store.editMessage (messageId: message.id,
764
- originalRawContent: 'old content' , newContent: 'new content' );
764
+ unawaited ( check ( store.editMessage (messageId: message.id,
765
+ originalRawContent: 'old content' , newContent: 'new content' )). throws < NetworkException >()) ;
765
766
checkNotifiedOnce ();
766
767
767
768
async .elapse (Duration (seconds: 1 ));
@@ -781,8 +782,8 @@ void main() {
781
782
782
783
connection.prepare (
783
784
httpException: const SocketException ('failed' ), delay: Duration (seconds: 1 ));
784
- store.editMessage (messageId: message.id,
785
- originalRawContent: 'old content' , newContent: 'new content' );
785
+ unawaited ( check ( store.editMessage (messageId: message.id,
786
+ originalRawContent: 'old content' , newContent: 'new content' )). throws < NetworkException >()) ;
786
787
checkNotifiedOnce ();
787
788
788
789
async .elapse (Duration (seconds: 1 ));
@@ -801,8 +802,8 @@ void main() {
801
802
check (store.getEditMessageErrorStatus (message.id)).isNull ();
802
803
803
804
connection.prepare (apiException: eg.apiBadRequest (), delay: Duration (seconds: 1 ));
804
- store.editMessage (messageId: message.id,
805
- originalRawContent: 'old content' , newContent: 'new content' );
805
+ unawaited ( check ( store.editMessage (messageId: message.id,
806
+ originalRawContent: 'old content' , newContent: 'new content' )). throws < ZulipApiException >()) ;
806
807
checkNotifiedOnce ();
807
808
async .elapse (Duration (seconds: 1 ));
808
809
check (store.getEditMessageErrorStatus (message.id)).isNotNull ().isTrue ();
@@ -818,8 +819,8 @@ void main() {
818
819
check (store.getEditMessageErrorStatus (message.id)).isNull ();
819
820
820
821
connection.prepare (apiException: eg.apiBadRequest (), delay: Duration (seconds: 1 ));
821
- store.editMessage (messageId: message.id,
822
- originalRawContent: 'old content' , newContent: 'new content' );
822
+ unawaited ( store.editMessage (messageId: message.id,
823
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
823
824
checkNotifiedOnce ();
824
825
825
826
async .elapse (Duration (milliseconds: 500 ));
@@ -843,8 +844,8 @@ void main() {
843
844
844
845
connection.prepare (
845
846
json: UpdateMessageResult ().toJson (), delay: Duration (seconds: 1 ));
846
- store.editMessage (messageId: message.id,
847
- originalRawContent: 'old content' , newContent: 'new content' );
847
+ unawaited ( store.editMessage (messageId: message.id,
848
+ originalRawContent: 'old content' , newContent: 'new content' )) ;
848
849
checkNotifiedOnce ();
849
850
850
851
async .elapse (Duration (milliseconds: 500 ));
0 commit comments