@@ -9,9 +9,12 @@ import 'package:zulip/model/channel.dart';
99import '../api/model/model_checks.dart' ;
1010import '../example_data.dart' as eg;
1111import '../stdlib_checks.dart' ;
12+ import 'binding.dart' ;
1213import 'test_store.dart' ;
1314
1415void main () {
16+ TestZulipBinding .ensureInitialized ();
17+
1518 group ('Unified stream/sub data' , () {
1619 /// Check that `streams` , `streamsByName` , and `subscriptions` all agree
1720 /// and point to the same objects where applicable.
@@ -456,6 +459,32 @@ void main() {
456459 });
457460
458461 group ('selfCanSendMessage' , () {
462+ test ('in group' , () {
463+ addTearDown (testBinding.reset);
464+ final now = testBinding.utcNow ();
465+
466+ final canSendMessageGroup = eg.groupSetting (members: [eg.selfUser.userId]);
467+ final channel = eg.stream (canSendMessageGroup: canSendMessageGroup);
468+ final store = eg.store (
469+ initialSnapshot: eg.initialSnapshot (streams: [channel]));
470+ check (store.selfCanSendMessage (inChannel: channel, byDate: now))
471+ .isTrue ();
472+ });
473+
474+ test ('not in group' , () {
475+ addTearDown (testBinding.reset);
476+ final now = testBinding.utcNow ();
477+
478+ final canSendMessageGroup = eg.groupSetting (members: []);
479+ final channel = eg.stream (canSendMessageGroup: canSendMessageGroup);
480+ final store = eg.store (
481+ initialSnapshot: eg.initialSnapshot (streams: [channel]));
482+ check (store.selfCanSendMessage (inChannel: channel, byDate: now))
483+ .isFalse ();
484+ });
485+ });
486+
487+ group ('selfCanSendMessage, legacy' , () {
459488 final testCases = [
460489 (ChannelPostPolicy .unknown, UserRole .unknown, true ),
461490 (ChannelPostPolicy .unknown, UserRole .guest, true ),
0 commit comments