Skip to content

Commit 5ef916d

Browse files
committed
(optional) use checkLogs for malformed submessage test.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent a57ce95 commit 5ef916d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/model/message_test.dart

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import '../api/model/model_checks.dart';
1414
import '../api/model/submessage_checks.dart';
1515
import '../example_data.dart' as eg;
1616
import '../stdlib_checks.dart';
17+
import '../test_log.dart';
1718
import 'message_list_test.dart';
1819
import 'store_checks.dart';
1920
import 'test_store.dart';
@@ -664,15 +665,18 @@ void main() {
664665

665666
test('ignore submessage event with malformed content', () async {
666667
final messageId = await preparePollMessage();
667-
await store.handleEvent(
668-
eg.submessageEvent(
669-
streamMessage.id,
670-
eg.selfUser.userId,
671-
content: jsonEncode({
672-
'type': 'question',
673-
// Invalid type for question
674-
'question': 123,
675-
})));
668+
await checkLogs(() async {
669+
await store.handleEvent(
670+
eg.submessageEvent(
671+
streamMessage.id,
672+
eg.selfUser.userId,
673+
content: jsonEncode({
674+
'type': 'question',
675+
// Invalid type for question
676+
'question': 123,
677+
})));
678+
})..length.equals(2)
679+
..last.contains('Malformed submessage event data for poll');
676680
checkNotNotified();
677681
check(store.messages[messageId]).isNotNull().poll.isNotNull();
678682
});

0 commit comments

Comments
 (0)