@@ -148,7 +148,7 @@ void main() {
148
148
149
149
test ('with nothing for topic' , () async {
150
150
final store = eg.store ();
151
- await store.addUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .muted);
151
+ await store.setUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .muted);
152
152
check (store.topicVisibilityPolicy (stream1.streamId, eg.t ('topic' )))
153
153
.equals (UserTopicVisibilityPolicy .none);
154
154
});
@@ -160,7 +160,7 @@ void main() {
160
160
UserTopicVisibilityPolicy .unmuted,
161
161
UserTopicVisibilityPolicy .followed,
162
162
]) {
163
- await store.addUserTopic (stream1, 'topic' , policy);
163
+ await store.setUserTopic (stream1, 'topic' , policy);
164
164
check (store.topicVisibilityPolicy (stream1.streamId, eg.t ('topic' )))
165
165
.equals (policy);
166
166
}
@@ -195,7 +195,7 @@ void main() {
195
195
final store = eg.store ();
196
196
await store.addStream (stream1);
197
197
await store.addSubscription (eg.subscription (stream1));
198
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
198
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
199
199
check (store.isTopicVisibleInStream (stream1.streamId, eg.t ('topic' ))).isFalse ();
200
200
check (store.isTopicVisible (stream1.streamId, eg.t ('topic' ))).isFalse ();
201
201
});
@@ -204,7 +204,7 @@ void main() {
204
204
final store = eg.store ();
205
205
await store.addStream (stream1);
206
206
await store.addSubscription (eg.subscription (stream1, isMuted: true ));
207
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unmuted);
207
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unmuted);
208
208
check (store.isTopicVisibleInStream (stream1.streamId, eg.t ('topic' ))).isTrue ();
209
209
check (store.isTopicVisible (stream1.streamId, eg.t ('topic' ))).isTrue ();
210
210
});
@@ -213,7 +213,7 @@ void main() {
213
213
final store = eg.store ();
214
214
await store.addStream (stream1);
215
215
await store.addSubscription (eg.subscription (stream1, isMuted: true ));
216
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .followed);
216
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .followed);
217
217
check (store.isTopicVisibleInStream (stream1.streamId, eg.t ('topic' ))).isTrue ();
218
218
check (store.isTopicVisible (stream1.streamId, eg.t ('topic' ))).isTrue ();
219
219
});
@@ -343,16 +343,16 @@ void main() {
343
343
group ('events' , () {
344
344
test ('add with new stream' , () async {
345
345
final store = eg.store ();
346
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
346
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
347
347
compareTopicVisibility (store, [
348
348
eg.userTopicItem (stream1, 'topic' , UserTopicVisibilityPolicy .muted),
349
349
]);
350
350
});
351
351
352
352
test ('add in existing stream' , () async {
353
353
final store = eg.store ();
354
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
355
- await store.addUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted);
354
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
355
+ await store.setUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted);
356
356
compareTopicVisibility (store, [
357
357
eg.userTopicItem (stream1, 'topic' , UserTopicVisibilityPolicy .muted),
358
358
eg.userTopicItem (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted),
@@ -361,35 +361,35 @@ void main() {
361
361
362
362
test ('update existing policy' , () async {
363
363
final store = eg.store ();
364
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
365
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unmuted);
364
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
365
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unmuted);
366
366
compareTopicVisibility (store, [
367
367
eg.userTopicItem (stream1, 'topic' , UserTopicVisibilityPolicy .unmuted),
368
368
]);
369
369
});
370
370
371
371
test ('remove, with others in stream' , () async {
372
372
final store = eg.store ();
373
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
374
- await store.addUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted);
375
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .none);
373
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
374
+ await store.setUserTopic (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted);
375
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .none);
376
376
compareTopicVisibility (store, [
377
377
eg.userTopicItem (stream1, 'other topic' , UserTopicVisibilityPolicy .unmuted),
378
378
]);
379
379
});
380
380
381
381
test ('remove, as last in stream' , () async {
382
382
final store = eg.store ();
383
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
384
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .none);
383
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
384
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .none);
385
385
compareTopicVisibility (store, [
386
386
]);
387
387
});
388
388
389
389
test ('treat unknown enum value as removing' , () async {
390
390
final store = eg.store ();
391
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
392
- await store.addUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unknown);
391
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .muted);
392
+ await store.setUserTopic (stream1, 'topic' , UserTopicVisibilityPolicy .unknown);
393
393
compareTopicVisibility (store, [
394
394
]);
395
395
});
0 commit comments