@@ -1277,19 +1277,28 @@ void main() {
12771277 check (done).isTrue ();
12781278 });
12791279
1280- test ('TopicAutocompleteView getStreamTopics request ' , () async {
1280+ test ('TopicAutocompleteView fetch topics once for a channel ' , () async {
12811281 final store = eg.store ();
12821282 final connection = store.connection as FakeApiConnection ;
12831283
12841284 connection.prepare (json: GetStreamTopicsResult (
1285- topics: [eg.getStreamTopicsEntry (name: '' )],
1285+ topics: [eg.getStreamTopicsEntry (name: 'topic ' )],
12861286 ).toJson ());
1287- TopicAutocompleteView .init (store: store, streamId: 1000 ,
1288- query: TopicAutocompleteQuery ('foo ' ));
1289- check (connection.lastRequest) .isA< http.Request > ()
1287+ final view = TopicAutocompleteView .init (store: store, streamId: 1000 ,
1288+ query: TopicAutocompleteQuery ('' ));
1289+ check (connection.takeRequests ()).last .isA< http.Request > ()
12901290 ..method.equals ('GET' )
12911291 ..url.path.equals ('/api/v1/users/me/1000/topics' )
12921292 ..url.queryParameters['allow_empty_topic_name' ].equals ('true' );
1293+ await Future (() {});
1294+
1295+ view.query = TopicAutocompleteQuery ('top' );
1296+ check (connection.takeRequests ()).isEmpty ();
1297+ view.dispose ();
1298+
1299+ TopicAutocompleteView .init (store: store, streamId: 1000 ,
1300+ query: TopicAutocompleteQuery ('topic' ));
1301+ check (connection.takeRequests ()).isEmpty ();
12931302 });
12941303
12951304 group ('TopicAutocompleteQuery.testTopic' , () {
0 commit comments