Skip to content

Commit f83c9c1

Browse files
committed
message test [nfc]: Move sendMessage smoke test to follow sendMessage
Ideally this would have been done when sendMessage itself was moved, in 942aa87 (#1455), oops.
1 parent 72cf5d6 commit f83c9c1

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

test/model/message_test.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@ void main() {
118118
}));
119119

120120
group('sendMessage', () {
121+
test('smoke', () async {
122+
final store = eg.store(initialSnapshot: eg.initialSnapshot(
123+
queueId: 'fb67bf8a-c031-47cc-84cf-ed80accacda8'));
124+
final connection = store.connection as FakeApiConnection;
125+
final stream = eg.stream();
126+
connection.prepare(json: SendMessageResult(id: 12345).toJson());
127+
await store.sendMessage(
128+
destination: StreamDestination(stream.streamId, eg.t('world')),
129+
content: 'hello');
130+
check(connection.takeRequests()).single.isA<http.Request>()
131+
..method.equals('POST')
132+
..url.path.equals('/api/v1/messages')
133+
..bodyFields.deepEquals({
134+
'type': 'stream',
135+
'to': stream.streamId.toString(),
136+
'topic': 'world',
137+
'content': 'hello',
138+
'read_by_sender': 'true',
139+
'queue_id': 'fb67bf8a-c031-47cc-84cf-ed80accacda8',
140+
'local_id': store.outboxMessages.keys.single.toString(),
141+
});
142+
});
143+
121144
final stream = eg.stream();
122145
final streamDestination = StreamDestination(stream.streamId, eg.t('some topic'));
123146
late StreamMessage message;

test/model/store_test.dart

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'package:zulip/api/model/events.dart';
1313
import 'package:zulip/api/model/initial_snapshot.dart';
1414
import 'package:zulip/api/model/model.dart';
1515
import 'package:zulip/api/route/events.dart';
16-
import 'package:zulip/api/route/messages.dart';
1716
import 'package:zulip/api/route/realm.dart';
1817
import 'package:zulip/log.dart';
1918
import 'package:zulip/model/actions.dart';
@@ -471,31 +470,6 @@ void main() {
471470
// (but they call the handleEvent method because it's the entry point).
472471
});
473472

474-
group('PerAccountStore.sendMessage', () {
475-
test('smoke', () async {
476-
final store = eg.store(initialSnapshot: eg.initialSnapshot(
477-
queueId: 'fb67bf8a-c031-47cc-84cf-ed80accacda8'));
478-
final connection = store.connection as FakeApiConnection;
479-
final stream = eg.stream();
480-
connection.prepare(json: SendMessageResult(id: 12345).toJson());
481-
await store.sendMessage(
482-
destination: StreamDestination(stream.streamId, eg.t('world')),
483-
content: 'hello');
484-
check(connection.takeRequests()).single.isA<http.Request>()
485-
..method.equals('POST')
486-
..url.path.equals('/api/v1/messages')
487-
..bodyFields.deepEquals({
488-
'type': 'stream',
489-
'to': stream.streamId.toString(),
490-
'topic': 'world',
491-
'content': 'hello',
492-
'read_by_sender': 'true',
493-
'queue_id': 'fb67bf8a-c031-47cc-84cf-ed80accacda8',
494-
'local_id': store.outboxMessages.keys.single.toString(),
495-
});
496-
});
497-
});
498-
499473
group('UpdateMachine.load', () {
500474
late TestGlobalStore globalStore;
501475
late FakeApiConnection connection;

0 commit comments

Comments
 (0)